|
|
@@ -32,13 +32,20 @@
|
|
|
mousewheelControl: false,
|
|
|
effect: 'fade',
|
|
|
lazyLoading: true,
|
|
|
+ loop: true,
|
|
|
prevButton: '.swiper-button-prev',
|
|
|
nextButton: '.swiper-button-next',
|
|
|
onTransitionStart: (swiper) => {
|
|
|
// 不要通过vue刷新dom,会导致pagination无法刷新
|
|
|
// this.activeSlide = swiper.activeIndex
|
|
|
+ if (this.banners.data.length && swiper.activeIndex > this.banners.data.length) {
|
|
|
+ swiper.activeIndex = 1
|
|
|
+ }
|
|
|
+ if (this.banners.data.length && swiper.activeIndex <= 0) {
|
|
|
+ swiper.activeIndex = this.banners.data.length
|
|
|
+ }
|
|
|
document.querySelector('.carousel').style.backgroundColor =
|
|
|
- this.banners.data[swiper.activeIndex].metadata['background-color']
|
|
|
+ this.banners.data[swiper.activeIndex - 1].metadata['background-color']
|
|
|
}
|
|
|
}
|
|
|
}
|