fix: prevent parent menu items from navigating, only toggle submenu
All checks were successful
Deploy Admin Frontend / build-and-deploy (push) Successful in 9s

This commit is contained in:
wangdl 2026-06-19 12:53:27 +08:00
parent 14bc16ea01
commit 83a7b56945

View File

@ -104,9 +104,11 @@ export default function AdminLayout() {
const items = filterMenuByRole(adminMenuItems, currentRole) const items = filterMenuByRole(adminMenuItems, currentRole)
return items return items
}} }}
menuItemRender={(item, dom) => ( menuItemRender={(item, dom) => {
<a onClick={() => item.path && navigate(item.path)}>{dom}</a> // Parent items with children should only toggle, not navigate
)} if ((item as any).children?.length) return dom
return <a onClick={() => item.path && navigate(item.path)}>{dom}</a>
}}
breadcrumbRender={(routers) => { breadcrumbRender={(routers) => {
// Hide breadcrumbs for full-screen iframe pages // Hide breadcrumbs for full-screen iframe pages
if (location.pathname === '/git') return [] if (location.pathname === '/git') return []