注意事项:调整指示点的位置时,需要结合transform: translate();去调整,因为.uni-swiper-dots-horizontal这个class原本设置的是transform: translate(50%);如果你不结合这个css属性去调整位置,可能无法达到预期
//未选中的指示点样式,支持h5、app
:deep(.uni-swiper-dot) {
background: red !important;
}
//选中的指示点样式,支持h5、app
:deep(.uni-swiper-dot-active) {
background: green !important;
}
//未选中的指示点样式,支持微信小程序
:deep(.wx-swiper-dot) {
background: #ccc !important;
}
//选中的指示点样式,支持微信小程序
:deep(.wx-swiper-dot-active) {
background: blue !important;
}
//指示点位置,支持h5、app
:deep(.uni-swiper-dots-horizontal) {
top: 30rpx !important;
right: 20rpx !important;
transform: translate(0%) !important;
text-align: right;
height: 0rpx;
}
//指示点位置,支持微信小程序
:deep(.wx-swiper-dots-horizontal) {
top: 30rpx !important;
right: 20rpx !important;
transform: translate(0%) !important;
text-align: right;
height: 0rpx;
}
效果: