mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-27 18:03:22 +08:00
fix(router): 修正根路由匹配逻辑和仪表板路由路径
修正根路由匹配逻辑,从基于路径匹配改为同时检查名称和路径,以避免潜在的路由冲突。同时将仪表板模块的基础路径从'/'改为'/dashboard',以改善路由结构。
This commit is contained in:
@@ -16,7 +16,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
title: $t('page.dashboard.title'),
|
title: $t('page.dashboard.title'),
|
||||||
},
|
},
|
||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
path: '/',
|
path: '/dashboard',
|
||||||
redirect: '/analytics',
|
redirect: '/analytics',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ async function generateAccessible(
|
|||||||
// 生成路由
|
// 生成路由
|
||||||
const accessibleRoutes = await generateRoutes(mode, options);
|
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) ?? [];
|
const names = root?.children?.map((item) => item.name) ?? [];
|
||||||
|
|||||||
Reference in New Issue
Block a user