1. 背景:嵌套swiper,父组件中有swiper,且该swiper中的子组件中又包含swiper,子swiper数据动态更新,子组件中swiper的autoplay属性失效
解决:在子组件页面加载完毕后,延迟初始化swiper或更新swiper
this.mySwiper2.update() // 延迟更新 重新初始化
2. 背景:swiper自动播放成功,但人为滑动轮播后,不再自动轮播
原因:autoplay中包含属性disableOnInteraction,其含义为 用户操作swiper之后,是否禁止autoplay。默认为true:停止。如果设置为false,用户操作swiper之后自动切换不会停止,每次都会重新启动autoplay。
解决:将disableOnInteraction的值改为false
autoplay:true,//等同于以下设置
autoplay: {
delay: 3000,
stopOnLastSlide: false,
disableOnInteraction: true,
},
待更新....