小程序 縱向輪播 顯示3列 每次滾動一個效果


wxml

<view class="swiper-view">
 <swiper next-margin="100rpx"  previous-margin="100rpx" class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000">
  <block wx:for="{{msgList}}">
   <swiper-item>
    <view class="swiper_item">{{item.title}}</view>
   </swiper-item>
  </block>
 </swiper>
</view>

wxss

.swiper-view{
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  border-radius: 5rpx;
  background: tomato
 }
 .swiper_container {
  height: 300rpx;
  width: 90%;
 }
  
 .swiper_item {
  height: 50rpx;
  width: 90%;
  font-size: 26rpx;
  white-space: nowrap;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  color: white
 }

js

Page({
  data: {
     msgList: [
      { title: "朋友圈" },
      { title: "文章" },
      { title: "公共號" },
      { title: "小程序" },
      { title: "音樂" },
      { title: "表情" },
      { title: "訂閱號" }
   ]
 }
})

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM