From b53e2d1eaafff2f80a1ebd6a42183e1ab36a6585 Mon Sep 17 00:00:00 2001 From: linxi <957440651@qq.com> Date: Tue, 25 Nov 2025 11:05:28 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A4655=20=E3=80=90=E6=97=85=E5=B1=85?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E5=9C=A8?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=86=84=E5=B1=8F=E6=88=96=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E8=BD=AF=E4=BB=B610=E7=A7=92=E9=92=9F=E4=BB=A5=E4=B8=8A?= =?UTF-8?q?=EF=BC=8C=E7=94=84=E9=80=89=E5=A5=BD=E7=A4=BC=E8=BD=AE=E6=92=AD?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BC=9A=E5=87=BA=E7=8E=B0=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=8A=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/index.vue | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/pages/home/index.vue b/pages/home/index.vue index a2f9875..1b599d2 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -189,7 +189,7 @@ - + @@ -459,7 +459,13 @@ export default { shareData: {}, currentIndex: 0, // 轮播组件实例 - swiperInstances: {} + swiperInstances: { + productSwiper: true, + homestay: true, + banner: true, + festival: true, + newZone: true, + } } }, onLoad() { @@ -487,6 +493,9 @@ export default { } }) }, + onShow() { + this.pageToShowHandle() + }, onHide() { this.pageToHideHandle() }, @@ -511,20 +520,27 @@ export default { // 页面显示时恢复轮播 pageToShowHandle() { // 恢复所有轮播组件的自动播放 - Object.values(this.swiperInstances).forEach(swiper => { - swiper && swiper.autoplayStart && swiper.autoplayStart() - }) + this.swiperInstances = { + productSwiper: true, + homestay: true, + banner: true, + festival: true, + newZone: true, + } }, // 页面隐藏时暂停轮播 pageToHideHandle() { - // 暂停所有轮播组件的自动播放 - Object.values(this.swiperInstances).forEach(swiper => { - swiper && swiper.autoplayStop && swiper.autoplayStop() - }) + this.swiperInstances = { + productSwiper: false, + homestay: false, + banner: false, + festival: false, + newZone: false, + } }, // 绑定轮播组件实例 bindSwiperInstance(e, key) { - this.swiperInstances[key] = e.detail + // this.swiperInstances[key] = e.detail }, changeRecommendKeyword(e) { this.keywordIndex = e