<view class='imgList'> <view class='imgList-li' wx:for='{{imgArr}}'> <image class='img' src='{{item}}' data-index='{{index}}' bindtap='previewImg'></image> </view> </view>
Page({ /** * 頁面的初始數據 */ data: { imgArr:[ 'http://bpic.jpg', 'http://bpic.jpg', 'http://bpic.jpg', 'http://bpic.jpg' ] }, previewImg:function(e){
let _this = this
//圖片預覽 wx.previewImage({ current:_this.imgArr[0] , // 當前顯示圖片的http鏈接 urls: _this.imgList // 需要預覽的圖片http鏈接列表 })
} })