这是一个NaN 2017-02-27 04:30 采纳率: 0%
浏览 1960

VUE 关于$nextTick的问题

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,希望有人指点

  • 写回答

1条回答 默认 最新

  • dabocaiqq 2017-02-27 23:53
    关注
    评论

报告相同问题?