这里主要用到了swiper的 current属性,写个点击按钮改变current的值就好了

<swiper
class="screen-swiper round-dot"
style="min-height: 600rpx"
:indicator-dots="true"
:circular="true"
@change="swiperChange"
:current="swiperIndex"
>
<swiper-item v-for="(item, index) in 5" :key="index">
<view
style="width: 100%; height: 600rpx"
:class="
index == 0 ? 'bg-green' : index == 1 ? 'bg-red' : 'bg-black'
"
>
</view>
</swiper-item>
</swiper>
<view class="btnTwo" @click="changeSwiper">下一步</view>
changeSwiper() {
this.swiperIndex++;
}
本文介绍了如何在Vue中利用Swiper库的current属性,配合按钮点击事件,实现Swiper滑动组件的动态切换,通过`:current`绑定变量控制滑动项样式变化。
2400

被折叠的 条评论
为什么被折叠?



