今天在微信小程序上开发,绑定事件后,出现bindtap传递参数to handle event tap错误。
<view bindtap="clickme('/pages/home/index')">链接</view>
提示信息为:
does not have a method "clickme('/pages/home/index')" to handle event "tap".
这是因为bindtap在传参时需要用到data-xxx来进行传递参数,正确的形式应当为:
<view bindtap="clickme" data-url="/pages/home/index">{{item.word}}</view> clickme: function (e) { console.log(e) },