如何自定義微信小程序swiper輪播圖面板指示點的樣式

微信小程序的swiper組件是滑塊視圖容器,也就是說日常咱們看到的輪播圖就能夠用它來作,不過這個組件有不少樣式是固定的,可是,有時候咱們的設計稿的面板指示點是須要個性化的,那麼如何去修改swiper組件的面板指示點的樣式呢?最近在使用swiper的時候也在想這個,最後發如今調試的時候,能夠看到他的選擇器。如圖:css

<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>
.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);    
}

  

雖然能夠經過上面的代碼修改swiper面板指示點的樣式,可是仍是有侷限性的,不過總算能夠修改了,在此簡單記錄一下。。  html

原文地址:http://www.qianduan8.com/1009.html小程序

相關文章
相關標籤/搜索