微信小程序开发笔记之swiper
2019-04-08 22:20
302 查看
swiper轮播图
小程序中的组件
配置参数:
微信官方文档:https://developers.weixin.qq.com/miniprogram/dev/component/swiper.html
常用配置:
indicatorDots:“true”,//是否显示面板指示点,默认为false
autoplay:“true”,//是否自动切换,默认为false
interval:“3000”,//自动切换时间间隔
duration:“500”,//滑动动画时长
circular:“true”,//是否采用衔接滑动,默认为false
swiperCurrent:“0”,//当前所在滑块的 index
示例代码:
index.wxml
<view class="top"> <swiper class="swiper" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="{{duration}}" current="{{swiperCurrent}}" > <block wx:for="{{imgUrls}}"wx:for-index="{{idx}}"> <swiper-item> <image src="{{item}}" class="img"/> </swiper-item> </block> </swiper> </view>
index.wxss
/*轮播图样式*/ page{ height:100%; } .top{ width:100%; height:35%; } .swiper{ width:100%; height:100%; } .img{ width:100%; height:100%; }
index.js
Page({ /** * 页面的初始数据 */ data: { indicatorDots:"true", autoplay:"true", interval:"3000", duration:"500", circular:"true", swiperCurrent:"0", imgUrls:[ "../../images/image1.jpg", "../../images/image2.jpg", "../../images/image3.jpg", "../../images/image2.jpg" ] } })
相关文章推荐
- 学习笔记_微信小程序开发--组建Swiper的使用
- 微信小程序开发日记之----swiper组件的坑
- 【微信小程序入门笔记】第一篇 微信开发工具安装
- 微信小程序开发一swiper轮播图的简单实现
- 微信小程序后端系统CMS开发笔记--04
- 微信小程序学习笔记1——开发环境搭建
- 微信小程序开发新手学习笔记
- 微信小程序开发学习笔记006--微信小程序组件详解02
- 微信小程序开发学习笔记004--微信小程序语法结构
- 学习笔记_微信小程序开发--常用快捷键
- 微信小程序支付开发笔记1--获取openId
- 微信小程序开发学习笔记002--微信小程序框架解密
- 微信小程序开发学习笔记007--微信小程序项目01
- 微信小程序开发学习笔记005--微信小程序组件详解
- 微信小程序支付开发笔记2--生成签名-统一下单-二次签名
- 微信小程序实例——天气预报开发笔记(进行中...)
- 微信小程序开发笔记
- 微信小程序开发(笔记)
- 【微信小程序开发笔记】--偶遇js深拷贝与浅拷贝问题
- 微信小程序开发 错误修改方法笔记