微信小程序?qū)崿F(xiàn)無(wú)限滾動(dòng)列表
本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)無(wú)限滾動(dòng)列表的具體代碼,供大家參考,具體內(nèi)容如下

效果圖1.0
實(shí)現(xiàn)方式是利用小程序原聲組件swiper,方向設(shè)置為縱向 :vertical=‘true'設(shè)置同時(shí)顯示的滑塊數(shù)量:display-multiple-items=‘4'設(shè)置自動(dòng)輪播:autoplay:‘true'.
話不所說(shuō),直接上代碼:
<!-- 底部排名 -->
<view class='contentBottom'>
<view class='BottomFirst'>
<text id='0' data-id='0'>獲獎(jiǎng)名單</text>
</view>
<swiper class="tab-right" style='background:{{bgColor}};' vertical="true" autoplay="true" circular="true" interval="2000" display-multiple-items='4'>
<view class="right-item">
<block wx:for-index="idx" wx:for='{{aa}}'>
<swiper-item>
<view class='content-item'>
<image src='{{item.avatarUrl}}' class='avater'></image>
<text class='name'>{{item.nickName}}</text>
<text class='wawa'>獲得獎(jiǎng)金{{item.reward}}元</text>
</view>
</swiper-item>
</block>
</view>
</swiper>
</view>
/* 底部滾動(dòng)列表 */
.contentBottom {
padding: 20rpx 0;
display: flex;
flex-direction: column;
justify-content: center;
background: #f8e1da;
}
.BottomFirst {
width: 90%;
display: flex;
justify-content: space-around;
border: 1px solid #663a83;
box-sizing: border-box;
margin: 0 auto;
}
.BottomFirst text {
width: 100%;
text-align: center;
font-size: 30rpx;
color: #663a83;
line-height: 60rpx;
border-right: 1px solid #663a83;
box-sizing: border-box;
}
.BottomFirst text:nth-child(1){
border: none;
}
.tab-right {
width: 90%;
margin: 20rpx auto;
height: 405rpx;
}
.right-item {
padding: 0 20rpx;
background: #fbeeed;
height: 100%;
width: 100%;
box-sizing: border-box;
}
.content-item {
height: 100rpx;
border-bottom: 1px solid #ede1d4;
width: 95%;
}
.avater {
height: 50rpx;
width: 50rpx;
border-radius: 100rpx;
margin-top: 25rpx;
float: left;
}
.name {
font-size: 26rpx;
float: left;
line-height: 100rpx;
color: #b0aaa9;
margin-left: 20rpx;
width: 40%;
height:100%;
overflow: hidden;
}
.wawa {
font-size: 26rpx;
float: right;
line-height: 100rpx;
color: #999;
}
data:{
aa:[
{
nickName:"wang",
reward:"2"
},
{
nickName: "wang",
reward: "2"
},
{
nickName: "wang",
reward: "2"
},
{
nickName: "wang",
reward: "2"
},
{
nickName: "wang",
reward: "2"
},
{
nickName: "wang",
reward: "2"
},
{
nickName: "wang",
reward: "2"
},
{
nickName: "wang",
reward: "2"
},
{
nickName: "wang",
reward: "2"
},
{
nickName: "wang",
reward: "2"
},
],
}
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
js實(shí)現(xiàn)電燈開(kāi)關(guān)效果
這篇文章主要為大家詳細(xì)介紹了js實(shí)現(xiàn)電燈開(kāi)關(guān)效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-01-01
打開(kāi)新窗口關(guān)閉當(dāng)前頁(yè)面不彈出關(guān)閉提示js代碼
打開(kāi)新窗口關(guān)閉當(dāng)前頁(yè)面時(shí)總是彈出提示框,有沒(méi)有辦法避免它的彈出呢,答案是可以的接下來(lái)為大家分享一個(gè)方法可以解決此問(wèn)題,感興趣的你可不要錯(cuò)過(guò)了哈,希望可以幫助到你2013-03-03
JavaScript使用?for...in?、?for...of?或者?forEach()?遍歷元素的示例
for...in?、?for...of?和?forEach?都是用于循環(huán)遍歷集合元素的方法,但它們之間有一些重要的區(qū)別,本文通過(guò)實(shí)例代碼介紹JavaScript使用?for...in?、?for...of?或者?forEach()?遍歷元素的相關(guān)知識(shí),感興趣的朋友一起看看吧2023-09-09
微信小程序中使用 async/await的方法實(shí)例分析
這篇文章主要介紹了微信小程序中使用 async/await的方法,結(jié)合實(shí)例形式分析了微信小程序中async/await的功能、使用方法及操作注意事項(xiàng),需要的朋友可以參考下2020-05-05
JavaScript中的一些實(shí)用小技巧總結(jié)
這篇文章主要給大家總結(jié)介紹了關(guān)于JavaScript中的一些實(shí)用小技巧,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用JavaScript具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04
javascript設(shè)計(jì)模式 – 訪問(wèn)者模式原理與用法實(shí)例分析
這篇文章主要介紹了javascript設(shè)計(jì)模式 – 訪問(wèn)者模式,結(jié)合實(shí)例形式分析了javascript訪問(wèn)者模式基本概念、原理、用法及操作注意事項(xiàng),需要的朋友可以參考下2020-04-04

