您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)微信小程序中<swiper-item>標(biāo)簽傳入數(shù)據(jù)的實(shí)現(xiàn)方法,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
微信小程序 <swiper-item>標(biāo)簽傳入數(shù)據(jù)
在<swiper-item>中用for循環(huán)傳入多個(gè)成對(duì)不同數(shù)據(jù)時(shí)的實(shí)現(xiàn)方法。
看下效果圖:
遍歷實(shí)現(xiàn)方法:wxss省略:
wxml中代碼:
<!--導(dǎo)航部分輪播圖--> <swiper class="navban" indicator-dots="{{indicatorDots}}" interval="{{interval}}" duration="{{duration}}"> <swiper-item> <block wx:for="{{navs}}"> <view class="navbox"> <image class="navimg" src="{{item.navimg}}"></image> <text class="navtext">{{item.navtext}}</text> </view> </block> </swiper-item> </swiper>
相對(duì)應(yīng)js里面的代碼:
var app = getApp() Page({ data: { navs:[ { navimg:'/images/i01.png', navtext:'掌上信息'}, { navimg:'/images/i02.png', navtext:'商家'}, { navimg:'/images/i03.png', navtext:'搶購(gòu)'}, { navimg:'/images/i04.png', navtext:'搶福利'}, { navimg:'/images/i05.png', navtext:'五折卡'}, { navimg:'/images/i06.png', navtext:'黑貓活動(dòng)'}, { navimg:'/images/i07.png', navtext:'本地圈'}, { navimg:'/images/i08.png', navtext:'順風(fēng)車'}, ], indicatorDots: true, autoplay: true, interval: 2000, duration: 1000, } })
關(guān)于“微信小程序中<swiper-item>標(biāo)簽傳入數(shù)據(jù)的實(shí)現(xiàn)方法”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。