This commit is contained in:
wfc 2025-02-28 15:09:56 +08:00
parent 2f39ecea3c
commit 3c9609c0a4
1 changed files with 5 additions and 2 deletions

View File

@ -27,8 +27,11 @@ export const NavigationMenu = () => {
} }
}, [isAuthenticated]); }, [isAuthenticated]);
const selectedKey = const selectedKey = useMemo(() => {
menuItems.find((item) => item.path === pathname)?.key || ""; const normalizePath = (path: string): string => path.replace(/\/$/, "");
return pathname === '/' ? "home" : menuItems.find((item) => normalizePath(pathname) === item.path)?.key || "";
}, [pathname]);
return ( return (
<Menu <Menu
mode="horizontal" mode="horizontal"