如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
wxml
<block wx:for="{{mz}}" > <image src='{{item}}' data-src='{{item}}' bindtap="previewImage"></image> </block>
js
data: { mz: [ 'http://t2.hddhhn.com/uploads/tu/201608/317/qlxs1dmwbi5.jpg', 'http://t2.hddhhn.com/uploads/tu/201706/395/c4.jpg', 'http://t2.hddhhn.com/uploads/tu/201704/10179/c6.jpg', 'http://t2.hddhhn.com/uploads/tu/201704/10181/c8.jpg', 'http://t1.27270.com/uploads/tu/201807/155/b7ffd3d76d_1.jpg', 'https://ws3.sinaimg.cn/large/0072Vf1pgy1foxlhftiaqj31kw0w0tun' ], }, /** * 预览多图片 */ previewImage: function (e) { var current = e.target.dataset.src; console.log(e) console.log(current); wx.previewImage({ current: current, // 当前显示图片的http链接 urls: this.data.mz // 需要预览的图片http链接列表 }) // wx.getImageInfo({// 获取图片信息(此处可不要) // src: '/images/tx1.jpg', // success: function (res) { // console.log(res.width) // console.log(res.height) // } // }) },