由于老项目用的swiper3,所以这里贴出来的是swiper3的配置项,swiper4的参照下面的稍作修改即可(原理就是通过回调自己手动控制)
autoplay: 0,
loop: false,
onInit: swiper => {
setTimeout(() => {
swiper.slideNext();
}, 1500);
},
onSlideChangeEnd: swiper => {
if (swiper.activeIndex === 1) {
let dom = swiper.slides[0];
swiper.removeSlide(0);
swiper.appendSlide(dom);
swiper.activeIndex = 0;
swiper.update();
setTimeout(() => {
swiper.slideNext();
}, 1500);
}
}