From 83a7b569454d5a740348f3f658d98123fd3f521c Mon Sep 17 00:00:00 2001 From: wangdl Date: Fri, 19 Jun 2026 12:53:27 +0800 Subject: [PATCH] fix: prevent parent menu items from navigating, only toggle submenu --- src/layouts/AdminLayout.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/layouts/AdminLayout.tsx b/src/layouts/AdminLayout.tsx index 34585b4..8739dc0 100644 --- a/src/layouts/AdminLayout.tsx +++ b/src/layouts/AdminLayout.tsx @@ -104,9 +104,11 @@ export default function AdminLayout() { const items = filterMenuByRole(adminMenuItems, currentRole) return items }} - menuItemRender={(item, dom) => ( - item.path && navigate(item.path)}>{dom} - )} + menuItemRender={(item, dom) => { + // Parent items with children should only toggle, not navigate + if ((item as any).children?.length) return dom + return item.path && navigate(item.path)}>{dom} + }} breadcrumbRender={(routers) => { // Hide breadcrumbs for full-screen iframe pages if (location.pathname === '/git') return []