【发布时间】:2016-07-29 16:07:16
【问题描述】:
谁能帮忙解决这个问题...
我有这个列表组件,我希望能够切换不同的数据存储(在 props 中定义)
mixins:[Reflux.listenTo(RecentPupilsStore, 'onChange')],
但我想这样做 -
mixins:[Reflux.listenTo(this.props.store, 'onChange')],
但在 mixin 中似乎没有可用的道具。我也尝试将其转移到函数中:
mixins:[Reflux.listenTo(this.setStore(this.props.store), 'onChange')],
setStore: function(store){
if(store == 'RecentPupilsStore') { return RecentPupilsStore; }
},
任何帮助表示赞赏。相当新的 ot 反应,但试图使其尽可能可重用!
EG:我想包含这样的组件:
<FilterList data="pupils" />
<FilterList data="groups" />
等 - 这些会查看这些商店。
【问题讨论】: