微信小程序点击下载查看图片

微信小程序点击下载查看图片

<view class="image_list" wx:if="{{show_status}}">
   <repeat for="{{ shopimgs }}" key="index" index="index" item="item">
      <view class="shop_list_image clearfix">
          <image data-index='{{index}}' @tap='previewImg' class="imagelist" src="{{item.imageUrl}}">image>
      view>
   repeat>
view>
previewImg(e){
    let index = e.currentTarget.dataset.index;
    let imgslist=[];
    let img='';
    for(let i=0;i<this.shopimgs.length;i++){
      img=this.shopimgs[i].imageUrl;
      imgslist.push(img)
    }
    let src=this.shopimgs[index].imageUrl;
    let imgArr=imgslist;
    wx.previewImage({
      current: src,     //当前图片地址
      urls: imgArr
    })
    wx.getImageInfo({
      src: this.shopimgs[index].imageUrl,
      success: function (res) {
        console.log(res.width)
        console.log(res.height)
      }
    })
  }

你可能感兴趣的:(微信小程序)