created() {
this.$http.get('/api/goods').then((response) => {
response = response.body;
if (response.errno === ERR_OK) {
this.goods = response.data;
}
});
this.$nextTick(() => {
this._initScroll();
});
},
methods: {
_initScroll() {
this.meunScroll = new BScroll(this.$els.menuWrapper, {});
this.foodsScroll = new BScroll(this.$els.foodsWrapper, {});
}
}
调用better-scroll插件报错;但是把this.$nextTick放进if里面就没有问题,
既然$nextTick是在dom加载完再执行那应该随便放哪儿都行啊?
初学vue,希望有人指点
VUE 关于$nextTick的问题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-