From 32c625ab2a89d07a9466bfd984d468aeb1da04c9 Mon Sep 17 00:00:00 2001 From: chenghuan Date: Wed, 25 Mar 2026 17:44:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E9=80=BB=E8=BE=91=E4=BB=A5=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=A4=84=E7=90=86=E5=BD=93=E5=89=8D=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E5=92=8C=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化了固定分类的判断逻辑,确保在当前索引为 null 或 undefined 时正确初始化,并在固定分类存在时调用 curseClick 方法。 --- pages/peanut/home.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue index 0822807..e9936ac 100644 --- a/pages/peanut/home.vue +++ b/pages/peanut/home.vue @@ -642,11 +642,16 @@ export default { //存储的需要固定分类 this.fixed = uni.getStorageSync("fixed"); //固定分类 - if (this.fixed) { - this.curseClick(this.currentItem, this.currentIndex); - } else { + if (this.currentIndex === null || this.currentIndex === undefined) { this.currentIndex = 0; - this.currentItem = null; + } + if ( + this.fixed && + this.currentItem && + this.currentIndex !== null && + this.currentIndex !== undefined + ) { + this.curseClick(this.currentItem, this.currentIndex); } uni.hideTabBar(); // #ifdef APP-PLUS