最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
微信小程序自定义轮播图
时间:2018-11-12 编辑:猪哥 来源:一聚教程网
本文实例为大家分享了微信小程序自定义轮播图展示的具体代码,供大家参考,具体内容如下
默认的swiper面板指示点都是小圆点黑灰的,但这满足不了广大小伙伴需求,比如其他颜色的,椭圆形的,方形的等等。
首先当然是要禁用掉(直接删掉)swiper属性indicator-dots,再用view组件模拟dots,对应的代码如下:
然后是wxss代码:
css;">swiper-container{ position: relative; } .swiper-container .swiper{ height: 300rpx; } .swiper-container .swiper .img{ width: 100%; height: 100%; } .swiper-container .dots{ position: absolute; left: 0; right: 0; bottom: 20rpx; display: flex; justify-content: center; } .swiper-container .dots .dot{ margin: 0 8rpx; width: 14rpx; height: 14rpx; background: #fff; border-radius: 8rpx; transition: all .6s; } .swiper-container .dots .dot.active{ width: 24rpx; background: #f80; }
再对swiper的bindchange属性绑定对应的事件:
Page({ data: { slider: [ {picUrl: '../../images/T003R720x288M000000rVobR3xG73f.jpg'}, {picUrl: '../../images/T003R720x288M000000j6Tax0WLWhD.jpg'}, {picUrl: '../../images/T003R720x288M000000a4LLK2VXxvj.jpg'}, ], swiperCurrent: 0, }, swiperChange: function(e){ this.setData({ swiperCurrent: e.detail.current }) } })
效果图:
相关文章
- 微信怎么上传抗原检测结果 微信上传抗原检测结果方法 04-15
- 微信运动如何设置状态 微信运动设置状态方法 03-30
- 微信怎么查询三个月前顺丰快递信息 微信查询三个月前顺丰快递信息方法 03-30
- 微信如何设置收款多人播报 微信设置收款多人播报方法 03-18
- 微信小老虎图标怎么设置 微信小老虎图标设置方法 03-09
- 微信如何绑定武汉通 微信绑定武汉通操作方法 03-19