微信小程序之swiper


 

微信小程序在插入輪播圖時需要用到swiper滑塊視圖容器,

swiper 里只能放置swiper-item(插槽)組件,否則會導致未定義的行為。

<view>
    <image class="top-theme" src="{{themeA.entrance_img}}"></image>
    <swiper class="swiper-img"
            indicator-dots="{{true}}"
            indicator-active-color="#157658"
            circular
            autoplay
            interval="2000">
        <block wx:for="{{bannerB[0].items}}" wx:key="key">
            <swiper-item>
                <image class="swiper-img" src="{{item.img}}"></image>
            </swiper-item>
        </block>
    </swiper>
</view>

indicator-dots="{{true}}" :顯示面板指示點

indicator-active-color="#157658" :設置選中的指示點顏色

circular:循環輪播
autoplay:自動切換
interval="2000":自動切換間隔時間、

示例:

 


免責聲明!

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



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