微信小程序点击图片预览-wx.previewImage

<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链接列表
    })
 } })
原文地址:https://www.cnblogs.com/ll15888/p/11757621.html