楼楼解决了吗?我也这样了
小程序for循环后,点击事件,单击一个按钮后,其他按钮一起变,如何给图片加上id?求助!<view class="anniu" wx:if="{{isplay==false}}" bindtap='play' data-ypname='{{item._id}}' id="{{index}}" > <image src='../../images/play.png' style="width:50px;height:50px;"></image> </view> <view class="anniu" wx:if="{{isplay==true}}" bindtap='stop'> <image src='../../images/pause.png' style="width:50px;height:50px;"></image> </view> play: function (ypname) { var dataset = ypname.currentTarget.dataset; var ypname = dataset.ypname; db.collection('PyFile').where({ _id: ypname }) .get({ success: function(res) { myaudio.src = res.data[0].file } }) //播放音频 myaudio.play(); console.log(myaudio.duration); this.setData({ isplay: true }); }, // 停止 stop: function () { myaudio.pause(); this.setData({ isplay: false }); } [图片][图片]
2022-11-18