700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > Uncaught TypeError: Cannot read property of undefined

Uncaught TypeError: Cannot read property of undefined

时间:2018-09-12 00:36:37

相关推荐

Uncaught TypeError: Cannot read property of undefined

vue中出现这种错误

Uncaught TypeError: Cannot read property of undefined或 Uncaught TypeError: this.myMethod is not a function

导致这种错误产生的原因是在选项 property 或回调上使用箭头函数

created: () => console.log(this.a) 或 vm.$watch('a', newValue => this.myMethod())

因为箭头函数并没有 this,this 会作为变量一直向上级词法作用域查找,直至找到为止

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。