微信小程序自定義swiper指示燈 一

wxml

<swiper class="swiper-box" indicator-dots="{{ indicatordots }}" autoplay="{{ autoplay }}">
    <block wx:for="{{ swiperItem }}">
        <swiper-item>
            <navigator url="{{ item.linkUrl }}">
                <image class="slide-image" src="{{ item.imgUrl }}"></image>
            </navigator>
        </swiper-item>
    </block>
</swiper>

wxss

.swiper-box .wx-swiper-dots.wx-swiper-dots-horizontal{
     margin-bottom: 2rpx;
}
.swiper-box .wx-swiper-dot{
    width:40rpx;
    display: inline-flex;
    height: 10rpx;
    margin-left: 20rpx;
    justify-content:space-between;
}
.swiper-box .wx-swiper-dot::before{
    content: '';
    flex-grow: 1; 
    background: rgba(255,255,255,0.8);
    border-radius: 8rpx
}
.swiper-box .wx-swiper-dot-active::before{
    background:rgba(244,0,0,0.8);   
}

最後實現效果

  

後續還會更新關於微信小程序實現的功能

如對你有幫助,可以加下QQ羣: 1102727334    有什麼問題都可以在羣裏問尋找解答方案

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章