微信小程序?qū)崿F(xiàn)無限滾動列表
更新時間:2020年05月29日 09:38:10 作者:進階的碼農(nóng)
這篇文章主要為大家詳細介紹了微信小程序?qū)崿F(xiàn)無限滾動列表,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了微信小程序?qū)崿F(xiàn)無限滾動列表的具體代碼,供大家參考,具體內(nèi)容如下

效果圖1.0
實現(xiàn)方式是利用小程序原聲組件swiper,方向設置為縱向 :vertical=‘true'設置同時顯示的滑塊數(shù)量:display-multiple-items=‘4'設置自動輪播:autoplay:‘true'.
話不所說,直接上代碼:
<!-- 底部排名 -->
<view class='contentBottom'>
<view class='BottomFirst'>
<text id='0' data-id='0'>獲獎名單</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'>獲得獎金{{item.reward}}元</text>
</view>
</swiper-item>
</block>
</view>
</swiper>
</view>
/* 底部滾動列表 */
.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"
},
],
}
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
打開新窗口關(guān)閉當前頁面不彈出關(guān)閉提示js代碼
打開新窗口關(guān)閉當前頁面時總是彈出提示框,有沒有辦法避免它的彈出呢,答案是可以的接下來為大家分享一個方法可以解決此問題,感興趣的你可不要錯過了哈,希望可以幫助到你2013-03-03
JavaScript使用?for...in?、?for...of?或者?forEach()?遍歷元素的示例
for...in?、?for...of?和?forEach?都是用于循環(huán)遍歷集合元素的方法,但它們之間有一些重要的區(qū)別,本文通過實例代碼介紹JavaScript使用?for...in?、?for...of?或者?forEach()?遍歷元素的相關(guān)知識,感興趣的朋友一起看看吧2023-09-09
javascript設計模式 – 訪問者模式原理與用法實例分析
這篇文章主要介紹了javascript設計模式 – 訪問者模式,結(jié)合實例形式分析了javascript訪問者模式基本概念、原理、用法及操作注意事項,需要的朋友可以參考下2020-04-04

