在微信小程中如何使用swiper组件实现图片切换显示

亚连
亚连 原创
2018-06-21 11:57:40 1598浏览

这篇文章主要介绍了微信小程使用swiper组件实现图片轮播切换显示功能,涉及swiper组件相关属性使用技巧,并附带源码供读者下载参考,需要的朋友可以参考下

本文实例讲述了微信小程使用swiper组件实现图片轮播切换显示功能。分享给大家供大家参考,具体如下:

关键代码

index.wxml:

<swiper indicator-dots="true"autoplay="true" interval="3000" duration="600" style="height:300px;">
 <swiper-item>
 <image src="../../pages/images/img1.png" style="display: block;height: 300px;"/>
 </swiper-item>
 <swiper-item>
 <image src="../../pages/images/img2.png" style="display: block;height: 300px;"/>
 </swiper-item>
 <swiper-item>
 <image src="../../pages/images/img3.png" style="display: block;height: 300px;"/>
 </swiper-item>
</swiper>

swiper组件属性说明如下:

属性名类型默认值说明最低版本
indicator-dotsBooleanfalse是否显示面板指示点
indicator-colorColorrgba(0, 0, 0, .3)指示点颜色1.1.0
indicator-active-colorColor#000000当前选中的指示点颜色1.1.0
autoplayBooleanfalse是否自动切换
currentNumber0当前所在页面的 index
intervalNumber5000自动切换时间间隔
durationNumber500滑动动画时长
circularBooleanfalse是否采用衔接滑动
verticalBooleanfalse滑动方向是否为纵向
bindchangeEventHandlecurrent 改变时会触发 change 事件,event.detail = {current: current, source: source}

上面是我整理给大家的,希望今后会对大家有帮助。

相关文章:

有关ES6/JavaScript使用技巧(详细教程)

在nodejs中如何实现爬取网站图片

有关JS抽象工厂模式(详细教程)

在Django与Vue语法中存在冲突问题如何解决

以上就是在微信小程中如何使用swiper组件实现图片切换显示的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。