add 登录默认加载第一个路由
This commit is contained in:
parent
012811712b
commit
1bf9c07ab7
@ -49,6 +49,17 @@ export async function initBackEndControlRoutes() {
|
||||
const routes = await backEndComponent(menus)
|
||||
dynamicRoutes[0].children?.unshift(...routes, ...commonRoutes)
|
||||
|
||||
// 在处理完 dynamicRoutes[0].children 后,设置根路由默认重定向
|
||||
const firstModule = dynamicRoutes[0].children && dynamicRoutes[0].children[0]
|
||||
if (firstModule) {
|
||||
let defaultRedirect = firstModule.path
|
||||
if (firstModule.children && firstModule.children.length > 0) {
|
||||
const firstChild = firstModule.children.find((c: any) => !c.meta?.isHide)
|
||||
if (firstChild) defaultRedirect = firstChild.path
|
||||
}
|
||||
dynamicRoutes[0].redirect = defaultRedirect
|
||||
}
|
||||
|
||||
// 添加动态路由
|
||||
await setAddRoute()
|
||||
// 设置路由到 pinia routesList 中(已处理成多级嵌套路由)及缓存多级嵌套数组处理后的一维数组
|
||||
|
Loading…
x
Reference in New Issue
Block a user