微信小程序 滚动列表(无限滚动)

我就是我 2021-12-11 14:23 1055阅读 0赞

20180507132001955
效果图1.0

实现方式是利用小程序原声组件swiper,方向设置为纵向 :vertical=‘true’设置同时显示的滑块数量:display-multiple-items=‘4’设置自动轮播:autoplay:‘true’.

话不所说,直接上代码:

  1. <view class='contentBottom'>
  2. <view class='BottomFirst'>
  3. <text id='0' data-id='0'>获奖名单</text>
  4. </view>
  5. <swiper class="tab-right" style='background:\{ \{bgColor\}\};' vertical="true" autoplay="true" circular="true" interval="2000" display-multiple-items='4'>
  6. <view class="right-item">
  7. <block wx:for-index="idx" wx:for='\{ \{aa\}\}'>
  8. <swiper-item>
  9. <view class='content-item'>
  10. <image src='\{ \{item.avatarUrl\}\}' class='avater'></image>
  11. <text class='name'>\{ \{item.nickName\}\}</text>
  12. <text class='wawa'>获得奖金\{ \{item.reward\}\}元</text>
  13. </view>
  14. </swiper-item>
  15. </block>
  16. </view>
  17. </swiper>
  18. </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”
},
],
}

转载自:https://blog.csdn.net/wangguang1995/article/details/80224354

发表评论

表情:
评论列表 (有 0 条评论,1055人围观)

还没有评论,来说两句吧...

相关阅读