本文實(shí)例講述了微信小程序swiper組件用法。分享給大家供大家參考,具體如下:
我們提供的服務(wù)有:網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、建鄴ssl等。為千余家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的建鄴網(wǎng)站制作公司
關(guān)于視圖容器swiper的詳細(xì)內(nèi)容可參考官方文檔
先來(lá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ì)大家微信小程序開(kāi)發(fā)有所幫助。
網(wǎng)站欄目:微信小程序swiper組件用法實(shí)例分析【附源碼下載】
鏈接URL:http://muchs.cn/article36/jpjosg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營(yíng)銷、網(wǎng)站改版、、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)