Unexpected side effect in "listShow" computed property
来源:17-21 购物车详情页实现(1)
xy36
2018-08-04


文件中listShow()
listShow() {
if (!this.totalCount) {
this.fold = true;
return false;
}
let show = !this.fold;
if (show) {
this.$nextTick(() => {
if (!this.scroll) {
this.scroll = new BScroll(this.$refs.listContent, {
click: true
});
} else {
this.scroll.refresh();
}
});
}
return show;
}
}
报错了,不知道哪里出问题了,怎么解决呢?求指教
写回答
1回答
-
ustbhuangyi
2018-08-05
这是新版 Vue.js 的报警,不要在计算属性中做赋值操作, 可以尝试用 watch 来实现类似的逻辑
10
相似问题