解决wx.previewImage不能对应显示(总显示第一张)
wxml页面代码:
<view class="bg-img" wx:for="{{goodsDetail.goodsImgFileIDList}}" wx:key="index" >
<image mode='aspectFill' src="{{item}}" data-index="{{index}}" bindtap="ViewImage" />
</view>
js页面代码:
//展示图片
ViewImage(e) {
let index = e.currentTarget.dataset.index
let imgAry = this.data.goodsDetail.goodsImgFileIDList //自己要显示图片的数组
wx.previewImage({
urls: imgAry,
current: imgAry[index]
})
},
1 回复