【wx小程序】Component “pages/cart/cart“ does not have a method “ handleAdd“ to handle event “ta

时间:2024-04-04 22:34:56

VM46425:1 Component “pages/cart/cart” does not have a method " handleAdd" to handle event “tap”.

这个报错是因为微信小程序在js文件里面可能没有办法找到你在页面里面所绑定的那个方法名,也可能是在wxml文件里面没有找到:
【wx小程序】Component “pages/cart/cart“ does not have a method “ handleAdd“ to handle event “ta
多余出来的空格可能让你的事件并没有绑定上去

在js文件里面可能是因为你把事件放到了data(基础数据定义)里面去了
【wx小程序】Component “pages/cart/cart“ does not have a method “ handleAdd“ to handle event “ta
把它拉出data的双括号就可以了

还有一种是最坑的,它没有办法通过v-for去携带某一条具体的参数:
【wx小程序】Component “pages/cart/cart“ does not have a method “ handleAdd“ to handle event “ta
还有许许多多的坑需要我们去踩
【wx小程序】Component “pages/cart/cart“ does not have a method “ handleAdd“ to handle event “ta