fix(router): 修正根路由匹配逻辑和仪表板路由路径

修正根路由匹配逻辑,从基于路径匹配改为同时检查名称和路径,以避免潜在的路由冲突。同时将仪表板模块的基础路径从'/'改为'/dashboard',以改善路由结构。
This commit is contained in:
dap
2026-03-10 19:25:05 +08:00
parent 1b63469c40
commit 486ce6a567
2 changed files with 4 additions and 2 deletions

View File

@@ -29,7 +29,9 @@ async function generateAccessible(
// 生成路由
const accessibleRoutes = await generateRoutes(mode, options);
const root = router.getRoutes().find((item) => item.path === '/');
const root = router
.getRoutes()
.find((item) => item.name === 'Root' && item.path === '/');
// 获取已有的路由名称列表
const names = root?.children?.map((item) => item.name) ?? [];