微信小程序swiper組件用法實(shí)例分析【附源碼下載】
本文實(shí)例講述了微信小程序swiper組件用法。分享給大家供大家參考,具體如下:
關(guān)于視圖容器swiper的詳細(xì)內(nèi)容可參考官方文檔
先來看看運(yùn)行效果:

index.js:
Page({
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'
],
indicatorDots: false,
autoplay: false,
interval: 5000,
duration: 1000
},
changeIndicatorDots: function (e) {
this.setData({
indicatorDots: !this.data.indicatorDots
})
},
changeAutoplay: function (e) {
this.setData({
autoplay: !this.data.autoplay
})
},
intervalChange: function (e) {
this.setData({
interval: e.detail.value
})
},
durationChange: function (e) {
this.setData({
duration: e.detail.value
})
}
})
index.wxml:
<swiper indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{imgUrls}}" wx:key="{{index}}">
<swiper-item>
<image src="{{item}}" class="slide-image" width="355" height="150" ></image>
<text class="textindex">{{index}}</text>
</swiper-item>
</block>
</swiper>
<button bindtap="changeIndicatorDots"> indicator-dots ({{indicatorDots}})</button>
<button bindtap="changeAutoplay"> autoplay ({{autoplay}})</button>
<slider bindchange="intervalChange" show-value min="2000" max="5000"/> interval
<slider bindchange="durationChange" show-value min="1000" max="2000"/> duration
index.wxss:
.slide-image{
display: inline;
}
.textindex{
position: absolute;
top :20px;
color: red;
}
附:完整實(shí)例代碼點(diǎn)擊此處本站下載。
希望本文所述對(duì)大家微信小程序開發(fā)有所幫助。
- 微信小程序 swiper組件輪播圖詳解及實(shí)例
- 微信小程序 swiper制作tab切換實(shí)現(xiàn)附源碼
- 微信小程序 解決swiper不顯示圖片的方法
- 微信小程序?qū)崿F(xiàn)頂部選項(xiàng)卡(swiper)
- 微信小程序?qū)崿F(xiàn)tab和swiper切換結(jié)合效果
- 微信小程序 <swiper-item>標(biāo)簽傳入數(shù)據(jù)
- 微信小程序修改swiper默認(rèn)指示器樣式的實(shí)例代碼
- 微信小程序使用swiper組件實(shí)現(xiàn)類3D輪播圖
- 微信小程序?qū)崿F(xiàn)swiper切換卡內(nèi)嵌滾動(dòng)條不顯示的方法示例
相關(guān)文章
用javascript對(duì)一個(gè)json數(shù)組深度賦值示例
本節(jié)主要介紹了用javascript對(duì)一個(gè)json數(shù)組深度賦值的具體實(shí)現(xiàn),需要的朋友可以參考下2014-07-07
js實(shí)現(xiàn)的簡單radio背景顏色選擇器代碼
這篇文章主要介紹了js實(shí)現(xiàn)的簡單radio背景顏色選擇器代碼,利用鼠標(biāo)事件及頁面元素動(dòng)態(tài)操作實(shí)現(xiàn)頁面背景顏色的改變功能,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08
javascript tips提示框組件實(shí)現(xiàn)代碼
一個(gè)簡單的類似title的提示效果,但現(xiàn)實(shí)內(nèi)容可以很豐富,以上js另存為tip.js,下面是使用的demo。2010-11-11
showModalDialog模態(tài)對(duì)話框的使用詳解以及瀏覽器兼容
showModalDialog是jswindow對(duì)象的一個(gè)方法,和window.open一樣都是打開一個(gè)新的頁面。區(qū)別是:showModalDialog打開子窗口后,父窗口就不能獲取焦點(diǎn)了(也就是無法操作了)2014-01-01
js中的eval()函數(shù)把含有轉(zhuǎn)義字符的字符串轉(zhuǎn)換成Object對(duì)象的方法
下面小編就為大家?guī)硪黄猨s中的eval()函數(shù)把含有轉(zhuǎn)義字符的字符串轉(zhuǎn)換成Object對(duì)象的方法。小編覺的挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-12-12
JavaScript實(shí)現(xiàn)二叉樹層序遍歷
這篇文章主要為大家簡單介紹一下JS中如何實(shí)現(xiàn)二叉樹層序遍歷,感興趣的小伙伴可以詳細(xì)參考閱讀2023-03-03

