【微信小程序】视图容器-swiper组件
来源:互联网 发布:优秀程序员简历模板 编辑:程序博客网 时间:2024/05/19 10:40
本文参考了微信官方文档:https://mp.weixin.qq.com/debug/wxadoc/dev/component/swiper.html?t=20161107
swiper组件有点像android中的ViewPager
swiper有下面几个重要的属性
属性名 类型 默认值 说明
index.wxml
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" current="{{currentPage}}"> <block wx:for="{{imgUrls}}"> <swiper-item> <image src="{{item}}" class="slide-image" width="355" height="150"/> </swiper-item> </block></swiper><button bindtap="changeIndicatorDots" style="width:400rpx;height=50rpx;margin-top:40rpx;"> indicator-dots </button><button bindtap="changeAutoplay" style="width:400rpx;height=50rpx;margin-top:40rpx;" > autoplay </button><button bindtap="nextPage" style="width:400rpx;height=50rpx;margin-top:40rpx;" > next page </button>
index.js
Page({ data: { imgUrls: [ 'http://e.hiphotos.baidu.com/image/pic/item/2fdda3cc7cd98d107ddbc53b233fb80e7bec90a9.jpg', 'http://f.hiphotos.baidu.com/image/pic/item/58ee3d6d55fbb2fbce67ca184d4a20a44623dc68.jpg', 'http://f.hiphotos.baidu.com/image/pic/item/279759ee3d6d55fbdf1e87f969224f4a21a4dd11.jpg' ], indicatorDots: false, autoplay: false, interval: 3000, duration: 1000, currentPage:1 }, changeIndicatorDots: function(e) { this.setData({ indicatorDots: !this.data.indicatorDots }) }, changeAutoplay: function(e) { this.setData({ autoplay: !this.data.autoplay }) }, nextPage: function(e) { var temp = this.data.currentPage + 1; if (temp >= 3) { temp = 0 ; } this.setData({ currentPage: temp }) }})
0 0
- 【微信小程序】视图容器-swiper组件
- 微信小程序的视图容器—swiper
- 微信小程序之滑块视图容器(swiper)
- 2.1.3微信小程序滑块视图容器 swiper
- 微信小程序—swiper(滑块视图容器)
- 【微信小程序】视图容器-view组件
- 【微信小程序】视图容器-scroll-view组件
- 微信小程序组件1--视图容器
- 微信小程序基础组件之视图容器
- 微信小程序中的swiper组件
- 微信小程序----组件之swiper
- swiper-滑块视图容器
- 微信小程序把玩(十)swiper组件
- 微信小程序 轮播图 swiper图片组件
- 微信小程序(轮播图 swiper组件)
- 学习微信小程序--组件(swiper)
- 微信小程序组件(二)swiper
- 微信小程序:视图容器
- 软考总结
- 手把手教你做个人 app
- Linux常用终端快捷键Bash快捷键
- win7x64下的redis安装与使用(Redis-x64-3.0.501)
- POJ 1027 The Same Game 大暴消
- 【微信小程序】视图容器-swiper组件
- serlet
- odroid x2安装 Android 4.1 Beta-1.5
- 为什么我的DevC++不可以使用C++11的一些语法?
- 使用XMLHttpRequest实现AJAx
- Java实现Html转PDF
- React Native react-native-vector-icons 使用小记
- 凸包问题
- 红点移动的原理