簡體   English   中英

為什么商店沒有看到回流的作用?

[英]Why is the store did not see action in reflux?

我收到以下錯誤

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 () {}
});

而這個觀點

操作= require('../../../../ Plus-WRIO-App / js / actions / menu')存儲= 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;

你有錯字 應該是createActions (復數)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM