设置小程序轮播图指示点样式

默认的指示点可以设置颜色和选中颜色

<swiper indicator-dots='true' indicator-color='#fff' indicator-active-color='#10c0e7'>
默认

如果我们要个性化设置指示点的样式,可以设置一个类名

<swiper class="swiper-box" autoplay='true' circular='true' interval="3000" duration="500" indicator-dots='true'>

以下样式设置了指示点颜色,形状,间距等属性

 .swiper-box .wx-swiper-dots.wx-swiper-dots-horizontal {
  margin-bottom: 2rpx;
}

.swiper-box .wx-swiper-dot {
  width: 60rpx;
  display: inline-flex;
  height: 6rpx;
  margin-left: 2rpx;
  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: #2C77ED;
}
效果如图
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容