1234567891011121314151617181920 |
- //在这个js文件中,专门来创建Store的实例对象
- import {action, observable} from 'mobx-miniprogram'
- export const store = observable(
- {
- numA:1,
- numB:2,
- //计算属性
- get sum(){
- return this.numA + this.numB
- },
- //actions 方法,用来修改store中的数据
- updateNum1:action(function(step){
- this.numA += step;
- }),
- updataNum2:action(function(step){
- this.numB +=step;
- })
- }
- )
|