在微信小程序中,轮播图上的小圆点默认样式为黑灰色,这在视觉体验上不是很惊艳眼球,有时达不到我们的需求。那么,怎样进行默认样式的改变呢?
需要准备的东西:3张图片(swiper1,swiper2,swiper3)~
为了方便大家理解代码以及本地图片的引入,这里把我的文件结构也show~
一、方法1
采用官方提供的swiper属性(indicator-color与indicator-active-color)进行改变,不熟悉的请点击这里,所有属性都有->
https://mp.weixin.qq.com/debug/wxadoc/dev/component/swiper.html。
效果:
首先来看改变后的效果~
源码:
wxml代码
<swiper class="swipers" indicator-dots="{
{indicatorDots}}" autoplay="{
{autoplay}}" indicator-color="{
{beforeColor}}"
indicator-active-color="{