如何自定义微信小程序swiper轮播图面板指示点的样式

微信小程序的swiper组件是滑块视图容器,也就是说平常我们看到的轮播图就可以用它来做,不过这个组件有很多样式是固定的,但是,有时候我们的设计稿的面板指示点是需要个性化的,那么如何去修改swiper组件的面板指示点的样式呢?最近在使用swiper的时候也在想这个,最后发现在调试的时候,可以看到他的选择器。如图:

1
2
3
4
5
6
7
8
9
< 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 >
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
.swiper-box .wx-swiper-dots.wx-swiper-dots-horizontal{
      margin-bottom 2 rpx;
}
.swiper-box .wx-swiper-dot{
     width : 40 rpx;
     display : inline-flex;
     height 10 rpx; 
     margin-left 20 rpx;
     justify- content :space-between;
}
.swiper-box .wx-swiper-dot::before{
     content '' ;
     flex-grow:  1 ;  
     background : rgba( 255 , 255 , 255 , 0.8 );
     border-radius:  8 rpx
}
.swiper-box .wx-swiper-dot-active::before{
     background :rgba( 244 , 0 , 0 , 0.8 );    
}

  

虽然可以通过上面的代码修改swiper面板指示点的样式,但是还是有局限性的,不过总算可以修改了,在此简单记录一下。。  

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值