我在学《饿了么webapp》开发中遇到:
created () {
this.classMap = ['decrease', 'discount', 'special', 'invoice', 'guarantee']
this.$http.get('/api/goods').then(response => {
this.goods = response.body.data
console.log(this.goods)
this.$nextTick(() => {
this._initScroll()
})
}, response => {
// error callback
})
},
methods: {
_initScroll () {
this.meunScroll = new BScroll(this.$refs.menuWrapper, {})
this.foodsScroll = new BScroll(this.$refs.foodsWrapper, {})
}
}
我用的vue2.0,跟视频里面不一样。
console报错:
Error in nextTick: "TypeError: Cannot read property '0' of undefined"
大神帮忙看看nextTick这个函数怎么会报错,谢谢啦
pardon110
相关分类