在下來刷新時,banner輪播圖播放混亂:ide
添加判斷oop
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)this