微信小程序之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