1
This commit is contained in:
@@ -175,7 +175,17 @@ export default class uiTool {
|
||||
redirect: '/home',
|
||||
component: Main,
|
||||
meta: { title: '首页', notCache: true },
|
||||
children: []
|
||||
children: [
|
||||
// 默认 home 路由,确保登录后能跳转
|
||||
{
|
||||
path: '/home',
|
||||
name: 'home',
|
||||
meta: { title: '首页', notCache: true },
|
||||
component: {
|
||||
render: h => h('div', { style: { padding: '20px' } }, '欢迎使用管理系统')
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -188,7 +198,17 @@ export default class uiTool {
|
||||
let menus = uiTool.transformTree(authorityMenus)
|
||||
let curRoutes = uiTool.menuToRoute(menus, ParentView, Page404)
|
||||
|
||||
mainRoute.children = curRoutes
|
||||
// 合并权限路由,保留默认 home 路由
|
||||
const homeRoute = mainRoute.children.find(r => r.name === 'home')
|
||||
const hasHome = curRoutes.some(r => r.name === 'home')
|
||||
|
||||
if (hasHome) {
|
||||
// 如果权限路由中有 home,使用权限路由的 home
|
||||
mainRoute.children = curRoutes
|
||||
} else {
|
||||
// 如果权限路由中没有 home,保留默认 home 并添加其他路由
|
||||
mainRoute.children = [homeRoute, ...curRoutes]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user