首页 > 技术文章 > swiper 下拉刷新混乱

hubgit 2018-02-26 17:00 原文

在下来刷新时,banner轮播图播放混乱:

添加判断

if(this.mySwiper.activeIndex){ this.mySwiper.destroy(true,false);//这句是关键,销毁有swiper上的事件,但是保存样式 } setTimeout(function(){ mySwiper = new Swiper('.swiper-container',{ loop: length>1 ?true:false, sapceBetween:30, centerdSlides:true, runCallbacksOnInit:true, on:{ }, autoplay:{ delay:2000, disableOnInteraction:false }, pagination:{ el:'.swiper-pagination', callback:true } }) },200)

推荐阅读