gpt4 book ai didi

javascript - 为什么店里没有看到回流 Action ?

转载 作者:行者123 更新时间:2023-12-02 15:30:37 24 4
gpt4 key购买 nike

我收到以下错误

actions.toggleMenu is not a function

我创建一个 Action

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

还有这个 View

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;

最佳答案

你有一个错字。它应该是createActions(复数)

关于javascript - 为什么店里没有看到回流 Action ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33351827/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com