微信小程使用swiper組件實現(xiàn)圖片輪播切換顯示功能【附源碼下載】
更新時間:2017年12月12日 10:01:08 作者:FutrueJet
這篇文章主要介紹了微信小程使用swiper組件實現(xiàn)圖片輪播切換顯示功能,涉及swiper組件相關(guān)屬性使用技巧,并附帶源碼供讀者下載參考,需要的朋友可以參考下
本文實例講述了微信小程使用swiper組件實現(xiàn)圖片輪播切換顯示功能。分享給大家供大家參考,具體如下:
1、效果展示

2、關(guān)鍵代碼
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-dots | Boolean | false | 是否顯示面板指示點 | |
| indicator-color | Color | rgba(0, 0, 0, .3) | 指示點顏色 | 1.1.0 |
| indicator-active-color | Color | #000000 | 當前選中的指示點顏色 | 1.1.0 |
| autoplay | Boolean | false | 是否自動切換 | |
| current | Number | 0 | 當前所在頁面的 index | |
| interval | Number | 5000 | 自動切換時間間隔 | |
| duration | Number | 500 | 滑動動畫時長 | |
| circular | Boolean | false | 是否采用銜接滑動 | |
| vertical | Boolean | false | 滑動方向是否為縱向 | |
| bindchange | EventHandle | current 改變時會觸發(fā) change 事件,event.detail = {current: current, source: source} |
3、源代碼點擊此處本站下載。
關(guān)于swiper詳細說明還可參考官方文檔:https://mp.weixin.qq.com/debug/wxadoc/dev/component/swiper.html
希望本文所述對大家微信小程序開發(fā)有所幫助。
相關(guān)文章
JavaScript函數(shù)的4種調(diào)用方法詳解
了解函數(shù)的調(diào)用過程有助于深入學習與分析JavaScript代碼。本文是JavaScript高級這個系列中的第三篇文章,主要介紹JavaScript中函數(shù)的四種使用形式2014-04-04
基于OL2實現(xiàn)百度地圖ABCD marker的效果
2015-10-10
uni-app微信小程序登錄并使用vuex存儲登錄狀態(tài)的思路詳解
這篇文章主要介紹了uni-app微信小程序登錄并使用vuex存儲登錄態(tài)的思路,本文給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2019-11-11

