解决wx.previewImage预览图片时总显示第一张
//wxml代码
<view class="bg-img" wx:for="{{ImgFileIDList}}" wx:key="index" >
<image lazy-load="true" mode='aspectFill' src="{{item}}" data-index="{{index}}" bindtap="ViewImage"/>
</view>
//js代码,展示预览图片
ViewImage(e) {
let index = e.currentTarget.dataset.index
//ImgFileIDList为自己要展示图片的数组
let imgAry = this.data.ImgFileIDList
wx.previewImage({
urls: imgAry,
current: imgAry[index]
})
},