From 05794055502216a0ffdbb08414a771b1fa649ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Sat, 27 Dec 2025 10:44:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=9C=A8=E9=9D=9E=E9=A6=96=E9=A1=B5=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BB=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 离开首页时 (onHide) 隐藏侧边栏按钮 - 返回首页时 (onShow) 恢复保存的按钮状态 --- pages/index/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pages/index/index.js b/pages/index/index.js index b4fc4eb..4eeedfa 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -224,9 +224,21 @@ Page({ const app = getApp(); app.updateCurrentTab('index'); app.globalData.showTabBar = true; + + const savedBtnHidden = wx.getStorageSync('sidebarBtnHidden'); + this.setData({ + sidebarBtnHidden: savedBtnHidden || false + }); + this.checkAndRestoreLoginStatus() }, + onHide: function () { + this.setData({ + sidebarBtnHidden: true + }); + }, + onPullDownRefresh: function() { this.onRefresh() },