• 小程序图片轮播自适应


    借(抄)鉴(袭)Thor UI 的!!!

    index.js

     1 Page({
     2   data: {
     3     banner: [
     4       "http://gw.alicdn.com/tfscom/i2/27574552/TB2LLz8ugJkpuFjSszcXXXfsFXa_!!27574552.jpg",
     5       "http://gw.alicdn.com/tfscom/i2/27574552/TB2LLz8ugJkpuFjSszcXXXfsFXa_!!27574552.jpg",
     6       "http://gw.alicdn.com/tfscom/i2/27574552/TB2LLz8ugJkpuFjSszcXXXfsFXa_!!27574552.jpg",
     7       "http://gw.alicdn.com/tfscom/i2/27574552/TB2LLz8ugJkpuFjSszcXXXfsFXa_!!27574552.jpg",
     8       "http://gw.alicdn.com/tfscom/i2/27574552/TB2LLz8ugJkpuFjSszcXXXfsFXa_!!27574552.jpg",
     9       "http://gw.alicdn.com/tfscom/i2/27574552/TB2LLz8ugJkpuFjSszcXXXfsFXa_!!27574552.jpg"
    10     ],
    11     scrollH: 0, //滚动总高度
    12     autoplay: false,//自动播放
    13     indicatorDots: true,//提示点
    14     circular: true,//是否采用衔接滑动
    15     duration: 200
    16   },
    17   onLoad: function (options) {
    18     wx.getSystemInfo({
    19       success: (res) => {
    20         this.setData({
    21           scrollH: res.windowWidth
    22         })
    23       }
    24     })
    25   }
    26 
    27 })

    index.wxml

    1 <view class="tui-banner-swiper">
    2   <swiper autoplay="{{autoplay}}" duration="{{duration}}" circular="{{circular}}" indicator-dots="{{indicatorDots}}" style="height:{{scrollH}}px" bindchange="bannerChange">
    3     <block wx:for="{{banner}}" wx:key="{{index}}">
    4       <swiper-item data-index="{{index}}" catchtap="previewImage">
    5         <image src="{{item}}" class="tui-slide-image" style="height:{{scrollH}}px" />
    6       </swiper-item>
    7     </block> 
    8   </swiper>
    9 </view>

    index.wxss

    1 .tui-banner-swiper {
    2   position: relative;
    3 }
    4 .tui-slide-image {
    5   width: 100%;
    6   display: block;
    7 }
  • 相关阅读:
    windows域相关
    IDEA 找不到maven编译命令操作
    Idea Cannot import to svn: Cannot run program "svn"
    NodeJS在CentOs7下安装
    NodeJS 安装不存在的模块
    NodeJS淘宝 CNPM 镜像
    Intellij Idea 使用入门教程
    Java中基本类型占用字节数
    JWT—JSON Web Token
    2016年度最受欢迎中国开源软件
  • 原文地址:https://www.cnblogs.com/iblackly/p/12654228.html
Copyright © 2020-2023  润新知