store文件中
@observable
类似state,写变量
@action
写ajax操作,改变observable (this.xxxx)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
业务组件中
@observer监听组件
在constructor函数中,this.store=new (Store)
在组件中可以改变observable中的变量值,this.store.变量名=XXX,
可以调用action函数,this.store.函数函数名,
其中嵌套的组件,<组件名 store={this.store}/>,该被嵌套的组件在constructor函数中,this.store=this.props.store(父子组件传值),在该呗嵌套组件中对store中数据的操作与之前一致。