diff --git a/src/router/helper/routeHelper.ts b/src/router/helper/routeHelper.ts index 3ad4824a..d1209a39 100644 --- a/src/router/helper/routeHelper.ts +++ b/src/router/helper/routeHelper.ts @@ -76,23 +76,13 @@ function dynamicImport(dynamicViewsModules: Record Promise(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(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 diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 16b984aa..98ba611c 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -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)