1.添加判断,如果轮播图为1张时,不滚动
This commit is contained in:
@@ -403,7 +403,7 @@
|
||||
},
|
||||
// 初始化 Swiper
|
||||
initSwiper() {
|
||||
if (this.swiperList.length === 0) return;
|
||||
if (this.swiperList.length <= 1) return;
|
||||
this.swiperInstance = new Swiper('.swiper-container', {
|
||||
loop: true,
|
||||
grabCursor: true,
|
||||
@@ -421,7 +421,7 @@
|
||||
},
|
||||
// Swiper 滑动事件处理
|
||||
onSwiperSlideChange() {
|
||||
if (!this.swiperInstance || this.swiperList.length === 0) return
|
||||
if (!this.swiperInstance || this.swiperList.length <= 1) return;
|
||||
// 获取当前索引
|
||||
const realIndex = this.swiperInstance.activeIndex;
|
||||
this.currentSwiperIndex = realIndex;
|
||||
|
||||
Reference in New Issue
Block a user