//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]
})
},
current: imgAry[index] 这个index不用,current: imgAry
预览不用index,把当前图片和数组传过去就可以了