zoukankan      html  css  js  c++  java
  • 二十五、小程序的图片预览(放大滑动)

    注意:好像图片必须在服务器上才可以浏览(我是这样的)

    WXML

    <view class='imgList'>      
      <view class='imgList-li' wx:for='{{imgArr}}'>
        <image class='img' src='{{item}}' data-index='{{index}}' bindtap='previewImg'></image>
      </view>
    </view>
    

      WCSS

    .imgList{
       100%;
    }
    .imgList .imgList-li{
       100%;
    }
    .imgList .imgList-li .img{
       400rpx;
      height: 400rpx;
    }
    

      JS

    Page({
      data: {
        imgArr: [ 'http://bpic.588ku.com/element_origin_min_pic/16/10/30/528aa13209e86d5d9839890967a6b9c1.jpg',
    'http://bpic.588ku.com/element_origin_min_pic/16/10/30/54fcef525fa8f6037d180f3c26f3be65.jpg',      'http://bpic.588ku.com/element_origin_min_pic/16/10/30/62e3ca3a02dddb002eff00482078d194.jpg', 'http://bpic.588ku.com/element_origin_min_pic/16/10/31/c7167fcfb4ebcd12621c05b0c852e98e.jpg',
    'https://ttcf.njpzd.com/static/beauty/beautyindex/bty01.png'
        ]
      },
      previewImg: function (e) {
        console.log(e.currentTarget.dataset.index);
        var index = e.currentTarget.dataset.index;
        var imgArr = this.data.imgArr;
        wx.previewImage({
          current: imgArr[index],     //当前图片地址
          urls: imgArr,               //所有要预览的图片的地址集合 数组形式
        })
      }
    })
    

      

  • 相关阅读:
    python3 爬取西祠代理IP数据
    电影天堂电影链接爬取
    腾讯招聘信息爬取
    妹子图图片爬取
    我爱我家数据爬取
    今日头条网页图片爬取
    快乐的正则一只
    百思不得姐首页爬取
    雪球网数据爬取
    Python Day79 form表单
  • 原文地址:https://www.cnblogs.com/deng-jie/p/9247020.html
Copyright © 2011-2022 走看看