小程序
小游戏
企业微信
微信支付
扫描小程序码分享
wxml页面下已经通过列表渲染的方式给onCollectionTap的点击事件传送了两个自定义参数,如下图所示编译后在调试器的wxml里也能正常看到两个data-接收到了正确的数据,如下图所示但是点击发现了问题,在点选不同的列表时currentTarget下的dataset并没有正确取值,如下图所示请大哥们帮助解决
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
来个代码片段?
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
<button id="collection{{index}}" style="display:none;" bindtap="onCollectionTap" data-id="{{item._id}}" data-messagesNumber="{{index}}"></button>
<label for="collection{{index}}" class="messages_foot_item_inner">
for是绑定id,你几个的id一样的。。肯定会有问题呀。。你像我写的这么改吧。。
为啥一定要拐弯抹角的把button隐藏起来,用label触发呢?
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
来个代码片段?
<button id="collection{{index}}" style="display:none;" bindtap="onCollectionTap" data-id="{{item._id}}" data-messagesNumber="{{index}}"></button>
<label for="collection{{index}}" class="messages_foot_item_inner">
for是绑定id,你几个的id一样的。。肯定会有问题呀。。你像我写的这么改吧。。
为啥一定要拐弯抹角的把button隐藏起来,用label触发呢?