报错
unexpected side effect in "listshow" computed property
解决
用watch包含listShow函数
watch: {
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;
}
},
原理
默认是设定 getter,这个过程中不应当修改实例的属性。
(待补充)