fix: url router
parent
2e72f5b4ac
commit
95bb3a2d28
|
@ -76,23 +76,13 @@ function dynamicImport(dynamicViewsModules: Record<string, () => Promise<Recorda
|
|||
// 将背景对象变成路由对象
|
||||
export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModule[]): T[] {
|
||||
routeList.forEach((route) => {
|
||||
if (route.children && route.parentId == 0) {
|
||||
if (isUrl(route.path)) {
|
||||
route.component = 'IFrame'
|
||||
} else if (route.children && route.parentId == 0) {
|
||||
route.component = 'LAYOUT'
|
||||
} else if (!route.children) {
|
||||
route.component = route.component as string
|
||||
}
|
||||
// if (isUrl(route.path)) {
|
||||
// route.component = 'LAYOUT'
|
||||
// const path = route.path
|
||||
// route.path = '/' + route.name
|
||||
// route.redirect = path
|
||||
// }
|
||||
if (isUrl(route.path)) {
|
||||
route.component = 'IFrame'
|
||||
// const path = route.path
|
||||
// route.path = '/' + route.name
|
||||
// route.redirect = path
|
||||
}
|
||||
const component = route.component as string
|
||||
if (component) {
|
||||
const meta = route.meta || {}
|
||||
|
@ -105,8 +95,6 @@ export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModul
|
|||
route.component = LayoutMap.get('LAYOUT'.toUpperCase())
|
||||
} else if (component.toUpperCase() === 'IFRAME') {
|
||||
route.component = LayoutMap.get('IFRAME'.toUpperCase())
|
||||
// meta.frameSrc = route.path
|
||||
// route.path = '/' + route.name
|
||||
} else {
|
||||
//处理顶级非目录路由
|
||||
meta.single = true
|
||||
|
|
|
@ -220,16 +220,13 @@ export const usePermissionStore = defineStore('app-permission', {
|
|||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
// Dynamically introduce components
|
||||
// 动态引入组件
|
||||
routeList = transformObjToRoute(routeList)
|
||||
|
||||
// Background routing to menu structure
|
||||
// 后台路由到菜单结构
|
||||
const backMenuList = transformRouteToMenu([dashboard, ...routeList, about])
|
||||
this.setBackMenuList(backMenuList)
|
||||
|
||||
// remove meta.ignoreRoute item
|
||||
// 删除 meta.ignoreRoute 项
|
||||
routeList = filter(routeList, routeRemoveIgnoreFilter)
|
||||
|
|
Loading…
Reference in New Issue