ustbhuangyi / vue-sell

:rice: Vue.js高仿饿了么外卖App课程源码 http://coding.imooc.com/class/74.html
3.46k stars 1.36k forks source link

关于better-scroll使用Cannot read property 'on' of undefined #15

Closed xiaosatufu closed 7 years ago

xiaosatufu commented 7 years ago

Uncaught (in promise) TypeError: Cannot read property 'on' of undefined at VueComponent._initScroll (eval at (app.js:750), :65:20) at VueComponent.eval [as _initScroll] (eval at (app.js:594), :216:72) at VueComponent.eval (eval at (app.js:750), :49:12) at Array.func (eval at (app.js:594), :491:10) at nextTickHandler (eval at (app.js:594), :447:16)

在使用better-scroll的时候,出现这个错误。请问老师这个是怎么解决的呢? 报错的是这一行。 this.foodScroll = new BScroll(this.$els.foodsWrapper, { probeType: 3 });

ustbhuangyi commented 7 years ago

检查一下你传入的 dom 是不是 undefined