为什么商店没有看到反流的动作?

时间:2015-10-26 17:23:23

标签: javascript reactjs flux refluxjs

我收到以下错误

  

actions.toggleMenu不是函数

我创建了一个动作

module.exports = Reflux.createAction([
    'callAi',
    'logout',
    'fullScreen',
    'toggleMenu',
    'showSidebar'
]);

我创建了这个商店

actions = require('../actions/menu.js');

module.exports = Reflux.createStore({
    listenables: actions,
    init: function () {
        console.log('init', this)  // Its good!
    },
    onCallAi: function () {},
    onLogout: function () {},
    onFullScreen: function () {},
    onToggleMenu: function () {
        console.log('actions onToggle', 'inMoment') //Not good
    },
    onShowSidebar: function () {}
});

这个观点

actions = require(' ../../../../ Plus-WRIO-App / js / actions / menu') store = require(' ../../../../ Plus-WRIO-App / js / stores / menu')

var CreateDomLeft = React.createClass({
    mixins: [Reflux.listenTo(store, "log")],
    toggle: function(){
        console.log('toggle', 'GO');
        actions.toggleMenu() // error here!!!
    },
    render: function() {
        return (
           <li onClick={this.toggle}  className='btn btn-link'></li>
        );
    }
});

module.exports = CreateDomLeft;

1 个答案:

答案 0 :(得分:2)

你有一个错字。它应该是{% trans "firstname" %}(复数)

相关问题