From 8dd5283892e7eb516cc2a65fe71aae17ac5906b7 Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Thu, 12 Nov 2026 10:32:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=BE=A7=E8=BE=B9=E6=A0=8F=E8=8F=9C=E5=8D=95=E9=A1=B9?= =?UTF-8?q?=E5=90=8E=E8=87=AA=E5=8A=A8=E6=94=B6=E8=B5=B7=E6=8A=BD=E5=B1=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/AppShell.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/layouts/AppShell.jsx b/src/layouts/AppShell.jsx index 9cb0be1..f7b19aa 100644 --- a/src/layouts/AppShell.jsx +++ b/src/layouts/AppShell.jsx @@ -19,6 +19,11 @@ export function AppShell() { const libraryItems = [[History, locale.history, '/history']]; const aboutItems = [[Info, locale.about, '/about']]; const immersive = location.pathname === '/shorts'; + // 移动端为抽屉式侧边栏,点击任一菜单项后必须收起 + const closeSidebarOnNavigate = (event) => { + if (!event.target.closest?.('a')) return; + if (window.matchMedia('(max-width: 760px)').matches) setSidebarOpen(false); + }; useEffect(() => { if (!createOpen) return undefined; const closeMenu = (event) => { @@ -84,7 +89,7 @@ export function AppShell() { -