正常显示:
图片放大:
.wxml文件
<view wx:for="{{result}}" wx:key="{{index}}">
<swiper class="image-type" indicator-color="fgba(255,255,255,.5)" indicator-active-color="#fff" indicator-dots circular autoplay>
<block wx:for="{{item.images_fileID}}" wx:key="{{index}}">
<swiper-item>
<image src="{{item}}" mode="scaleToFill" bindtap="img" data-src="{{item}}"></image>
</swiper-item>
</block>
</swiper>
</view>
.wxss文件略
.js文件
data: {
result: [],
},
//图片点击事件
img: function(event) {
let arr = [];
arr.push(this.data.result[0].images_fileID);
var src = event.currentTarget.dataset.src; //获取data-src
// var imgList = that.data.result.images_fileID;
//图片预览
wx.previewImage({
current: src, // 当前显示图片的http链接
urls: arr[0] // 需要预览的图片http链接列表
})
},