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() { -