computed后的foo.get()没有得到想要的原始值
var foo = computed(function(){return store.string +"/" + store.number;});
console.log(foo.get());
得到的是
undefined/undefined
这是怎么回事?
var foo = computed(function(){return store.string +"/" + store.number;});
console.log(foo.get());
得到的是
undefined/undefined
这是怎么回事?
2018-09-06
import {observable, isArrayLike, computed, action, autorun, when, reaction} from "mobx"; class Store { @observable array = []; @observable obj = {}; @observable map = new Map(); @observable string = 'hello'; @observable number = 20; @observable bool = true; @computed get mixed() { return store.string + ':' + store.number; } } let store = new Store(); var foo = computed(function(){return store.string +"/" + store.number;}); console.log(foo.get());
举报