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]
})
},
我记得明明收藏了,就是找不到,非常感谢这个方案
最后补充个代码片段:
https://developers.weixin.qq.com/s/kSKrV5mZ7Egq