错误:[mobx]不允许通过更改已观察到的可观察值来导致计算值产生副作用。试图修改:

时间:2019-10-01 11:22:49

标签: reactjs react-native native mobx

我正在尝试添加和删除过滤事件的上载gif

我在哪里失败了?

    @observable loading = false; //Loading variable being tracked in component
    @computed get filtered() {
    this.loading=true;//true
    let filteredList = this.list.filter(
      item => item.data.some(
        obj => obj.tr_x.toLowerCase().includes(this.filterTermValue)
      )
    );
    this.loading=false;//false
    if (filteredList.length)
      return filteredList;
    return this.list;
  }

0 个答案:

没有答案