From b37aa22570430bc894998373251703656a17eb9b Mon Sep 17 00:00:00 2001 From: xingyuv Date: Mon, 20 Mar 2023 14:20:22 +0800 Subject: [PATCH] feat: router --- src/router/helper/routeHelper.ts | 14 ++++++++++++++ src/views/visualization/jmreport/index.vue | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 src/views/visualization/jmreport/index.vue diff --git a/src/router/helper/routeHelper.ts b/src/router/helper/routeHelper.ts index 05cbb3b0..6967f32c 100644 --- a/src/router/helper/routeHelper.ts +++ b/src/router/helper/routeHelper.ts @@ -5,6 +5,7 @@ import { getParentLayout, LAYOUT, EXCEPTION_COMPONENT } from '@/router/constant' import { cloneDeep, omit } from 'lodash-es' import { warn } from '@/utils/log' import { createRouter, createWebHashHistory } from 'vue-router' +import { isUrl } from '@/utils/is' export type LayoutMapKey = 'LAYOUT' const IFRAME = () => import('@/views/base/iframe/FrameBlank.vue') @@ -78,6 +79,11 @@ export function transformObjToRoute(routeList: AppRouteModul } else if (!route.children) { route.component = route.component as string } + + if (isUrl(route.path)) { + console.info(route) + route.component = 'IFRAME' + } const component = route.component as string if (component) { if (component.toUpperCase() === 'LAYOUT') { @@ -86,6 +92,14 @@ export function transformObjToRoute(routeList: AppRouteModul meta.title = route.name meta.icon = route.icon route.meta = meta + } else if (component.toUpperCase() === 'IFRAME') { + route.component = LayoutMap.get('IFRAME'.toUpperCase()) + const meta = route.meta || {} + meta.title = route.name + meta.icon = route.icon + meta.frameSrc = route.path + route.meta = meta + route.path = '/' + route.name } else { //处理顶级非目录路由 const meta = route.meta || {} diff --git a/src/views/visualization/jmreport/index.vue b/src/views/visualization/jmreport/index.vue new file mode 100644 index 00000000..83cefa17 --- /dev/null +++ b/src/views/visualization/jmreport/index.vue @@ -0,0 +1,3 @@ +