微信小程swiper組件實(shí)現(xiàn)圖片輪播切換功能
- 來源:縱橫數(shù)據(jù)
- 作者:中橫科技
- 時(shí)間:2017/12/13 9:59:00
- 類別:新聞資訊
本文主要介紹了微信小程使用swiper組件實(shí)現(xiàn)圖片輪播切換顯示功能,涉及swiper組件相關(guān)屬性使用技巧,希望能幫助到大家。
1、效果展示
2、關(guān)鍵代碼
index.wxml:
1 2 3 4 5 6 7 8 9 10 11 | < 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組件屬性說明如下:
屬性名 | 類型 | 默認(rèn)值 | 說明 | 最低版本 |
---|---|---|---|---|
indicator-dots | Boolean | false | 是否顯示面板指示點(diǎn) | |
indicator-color | Color | rgba(0, 0, 0, .3) | 指示點(diǎn)顏色 | 1.1.0 |
indicator-active-color | Color | #000000 | 當(dāng)前選中的指示點(diǎn)顏色 | 1.1.0 |
autoplay | Boolean | false | 是否自動(dòng)切換 | |
current | Number | 0 | 當(dāng)前所在頁面的 index | |
interval | Number | 5000 | 自動(dòng)切換時(shí)間間隔 | |
duration | Number | 500 | 滑動(dòng)動(dòng)畫時(shí)長(zhǎng) | |
circular | Boolean | false | 是否采用銜接滑動(dòng) | |
vertical | Boolean | false | 滑動(dòng)方向是否為縱向 | |
bindchange | EventHandle | current 改變時(shí)會(huì)觸發(fā) change 事件,event.detail = {current: current, source: source} |
縱橫數(shù)據(jù)成立于2005年,擁有電信IDC/ISP資質(zhì),面向全國(guó)提供云計(jì)算、國(guó)際IDC、主機(jī)域名、建站營(yíng)銷、軟件開發(fā)、通信工程、機(jī)房大帶寬、技術(shù)外包等,專業(yè)的互聯(lián)網(wǎng)服務(wù)提供商;一站式云計(jì)算解決方案提供商!
聲明:文章來自網(wǎng)絡(luò)轉(zhuǎn)載,若無意中有侵犯您權(quán)益的信息,請(qǐng)聯(lián)系我們,我們會(huì)在第一時(shí)間刪除!