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[] {
|
export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModule[]): T[] {
|
||||||
routeList.forEach((route) => {
|
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'
|
route.component = 'LAYOUT'
|
||||||
} else if (!route.children) {
|
} else if (!route.children) {
|
||||||
route.component = route.component as string
|
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
|
const component = route.component as string
|
||||||
if (component) {
|
if (component) {
|
||||||
const meta = route.meta || {}
|
const meta = route.meta || {}
|
||||||
|
@ -105,8 +95,6 @@ export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModul
|
||||||
route.component = LayoutMap.get('LAYOUT'.toUpperCase())
|
route.component = LayoutMap.get('LAYOUT'.toUpperCase())
|
||||||
} else if (component.toUpperCase() === 'IFRAME') {
|
} else if (component.toUpperCase() === 'IFRAME') {
|
||||||
route.component = LayoutMap.get('IFRAME'.toUpperCase())
|
route.component = LayoutMap.get('IFRAME'.toUpperCase())
|
||||||
// meta.frameSrc = route.path
|
|
||||||
// route.path = '/' + route.name
|
|
||||||
} else {
|
} else {
|
||||||
//处理顶级非目录路由
|
//处理顶级非目录路由
|
||||||
meta.single = true
|
meta.single = true
|
||||||
|
|
|
@ -220,16 +220,13 @@ export const usePermissionStore = defineStore('app-permission', {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dynamically introduce components
|
// Dynamically introduce components
|
||||||
// 动态引入组件
|
// 动态引入组件
|
||||||
routeList = transformObjToRoute(routeList)
|
routeList = transformObjToRoute(routeList)
|
||||||
|
|
||||||
// Background routing to menu structure
|
// Background routing to menu structure
|
||||||
// 后台路由到菜单结构
|
// 后台路由到菜单结构
|
||||||
const backMenuList = transformRouteToMenu([dashboard, ...routeList, about])
|
const backMenuList = transformRouteToMenu([dashboard, ...routeList, about])
|
||||||
this.setBackMenuList(backMenuList)
|
this.setBackMenuList(backMenuList)
|
||||||
|
|
||||||
// remove meta.ignoreRoute item
|
// remove meta.ignoreRoute item
|
||||||
// 删除 meta.ignoreRoute 项
|
// 删除 meta.ignoreRoute 项
|
||||||
routeList = filter(routeList, routeRemoveIgnoreFilter)
|
routeList = filter(routeList, routeRemoveIgnoreFilter)
|
||||||
|
|
Loading…
Reference in New Issue