Error in v-on handler: “TypeError: _vm.addCart is not a function“
代码很简单,就是写了一个函数, 点击按钮后调用不了并且报错
具体报错如下:
[Vue warn]: Property or method "addCart" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
以及
[Vue warn]: Error in v-on handler: "TypeError: _vm.addCart is not a function"
查了很久,大部分人碰到这种is not a function报错的问题都是出在,data和methods里的属性和方法使用了重复的命名。
比如这位和我报的错看起来就是一样的:https://www.jianshu.com/p/0ffb60fd03e8
但是我这个*傻得并不简单,我错在把methods写成了method
这种问题可能也就我会碰上了= = !引以为戒