微信小程序swiper滑块视图容器控件使用整理
2019独角兽企业重金招聘Python工程师标准>>>
一、默认使用
indicator-dots,指示是否面板显示
indicator-color,指示点颜色
indicator-active-color,选中指示点颜色
wxml代码:
<swiper autoplay="{{autoplay}}"indicator-dots='true'indicator-active-color='red'interval="3000" duration="1000"><block wx:for="{{imgUrls}}"><swiper-item><image src="{{item}}" class="slide-image" width="355" height="150" /></swiper-item></block>
</swiper>
js代码:
data: {imgUrls: ['http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg','http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg','http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'],autoplay: true,},
显示结果:
二、重定义,指示点样式
操作:禁用默认指示样式,自定义view显示,根据当前current,设置选中项
1.wxml定义
<view class='swiper'><swiper autoplay="{{autoplay}}"bindchange="swiperChange"current='{{curIndex}}' interval="{{interval}}" duration="{{duration}}"><block wx:for="{{imgUrls}}"><swiper-item><image src="{{item}}" class="slide-image" width="355" height="150" /></swiper-item></block></swiper><!-- 自定义指示 --><view class='dots'><view class='dot {{curIndex==index?"active":""}}' wx:for="{{imgUrls}}"></view></view>
</view>
2.js定义
/*** 页面的初始数据*/data: {imgUrls: ['http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg','http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg','http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'],autoplay: false,interval: 5000,duration: 1000,curIndex: 0},
3.css样式定义
.swiper {position: relative;
}.swiper image {width: 100%;
}.swiper .dots {position: absolute;left: 0;right: 0;bottom: 20rpx;display: flex;justify-content: center;
}.swiper .dots .dot {margin: 0 8rpx;width: 14rpx;height: 14rpx;background: #fff;border-radius: 8rpx;transition: all 0.6s;
}.swiper .dots .dot.active {width: 24rpx;background: red;
}
3.显示样式
更多:
微信小程序selectComponent获取自定义子组件
微信小程序组件间通信(二)
微信小程序组件间通信(一)
转载于:https://my.oschina.net/tianma3798/blog/2252465
微信小程序swiper滑块视图容器控件使用整理相关推荐
- 微信小程序 (组件---视图组件案例)
滑块视图容器swiper和滑块swiper-item组件 小程序scroll-view实现横向滚动导航 scroll-view满屏滚动 滚动Tab选项卡 一.滑块视图容器swiper和滑块swiper ...
- 微信小程序之可滚动视图 scroll-view 的使用注意
微信小程序之可滚动视图 scroll-view 使用注意: 1.scroll-view 中的需要滑动的元素不可以用 float 浮动: 2.scroll-view 中的包裹需要滑动的元素的大盒子用 d ...
- 绑定bindchange事件的微信小程序swiper闪烁,抖动问题解决,(将微信小程序切换到后台一段时间,再打开微信小程序,会出现疯狂循环轮播,造成抖动现象)
绑定bindchange事件的微信小程序swiper闪烁,抖动问题解决,(将微信小程序切换到后台一段时间,再打开微信小程序,会出现疯狂循环轮播,造成抖动现象) 参考文章: (1)绑定bindchang ...
- 微信小程序swiper不限数量不卡顿
详情见:微信小程序swiper不限数量不卡顿轮播图优化组件(含uniapp版和纯微信开发者工具版),欢迎打包下载啦_swiper小程序插件_KV_T的博客-CSDN博客
- 微信小程序swiper图片尺寸_微信小程序 swiper 轮播图 高度自适应
微信小程序 swiper 轮播图 高度自适应 发布时间:2018-07-20 15:34, 浏览次数:588 , 标签: swiper 小程序中使用swiper 组件 ,实现轮播图高度自适应效果. 先 ...
- 微信小程序---swiper轮播图组件
微信小程序-swiper轮播图组件 在components中新建文件夹swiper components/swiper/swiper.wxml <!--components/swiper/swi ...
- php 小程序轮播图,微信小程序swiper组件构建轮播图代码分享
本文主要和大家介绍微信小程序 swiper组件构建轮播图的实例的相关资料,如有疑问请留言或者到本站社区交流讨论,需要的朋友可以参考下,希望能帮助到大家. 微信小程序 swiper组件构建轮播图的实例 ...
- swiper高度自适应_微信小程序swiper高度自适应
微信小程序swiper高度自适应的实现方式,首先swiper默认最小高度150,下面请看开发实例. 要求:swiper高度自适应 wxml wxss .swiper image { width: 10 ...
- 微信小程序获取二维码接口整理,.Net Core后台获取小程序二维码
2019独角兽企业重金招聘Python工程师标准>>> 一.关于二维码接口说明 参考:https://my.oschina.net/tianma3798/blog/1811307 获 ...
最新文章
- 中文.TW台湾域名首度向大陆开放
- 一文说通Dotnet Core的后台任务
- C - Digital Path 计蒜客 - 42397(dp记忆化搜索)
- 带弹簧的Hazelcast分布式执行
- 仪表盘刻度调整_惊艳了我的仪表盘 那些年我遇到最美的“面孔”
- 在百度超级链Xuper上部署智能合约并实现存证功能
- oracle 10g for solaris准备工作和实例的删除
- uat测试用例和sit测试用例_集成测试和UAT测试(8.7)
- php去除前两位,php去除前后空格的实现方法
- foxmail本地文件夹同步服务器,foxmail同步QQ邮箱里的所有文件夹
- android 页面跳转代码
- java servlet面试题_JavaWeb之JSP和servlet面试题附答案
- jQuery TagsInput
- BZOJ_2393_Cirno的完美算数教室BZOJ_1853_[Scoi2010]幸运数字 _深搜+容斥原理
- 关于实习、校招的科普
- 信息安全工具汇总整理
- ae破碎效果在哪_AE教程 | 五分钟制作文字破碎效果
- 【历史上的今天】11 月 16 日:RISC-V 领导者出生;微软发布 Windows CE;电子管问世
- 浪潮服务器自研芯片,5G、AI高度融合发展,浪潮服务器满足各种AI场景应用需求...
- 查看U盘占用程序的方法