Commit 1c4dd60e6199dc1da971ee80e36a4ffa2c37f2c7
Merge branch 'fix/outside-link' into 'main_dev'
fix: 修改菜单目录外链跳转问题 See merge request yunteng/thingskit-front!832
Showing
2 changed files
with
10 additions
and
0 deletions
| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
| 20 | 20 | import { useAppInject } from '/@/hooks/web/useAppInject'; |
| 21 | 21 | import { useDesign } from '/@/hooks/web/useDesign'; |
| 22 | + import { OUTSIDE_LINK_PREFIX } from '/@/router/helper/routeHelper'; | |
| 22 | 23 | |
| 23 | 24 | export default defineComponent({ |
| 24 | 25 | name: 'LayoutMenu', |
| ... | ... | @@ -113,6 +114,11 @@ |
| 113 | 114 | */ |
| 114 | 115 | |
| 115 | 116 | function handleMenuClick(path: string) { |
| 117 | + if (path.startsWith(OUTSIDE_LINK_PREFIX)) { | |
| 118 | + path = path.replace(OUTSIDE_LINK_PREFIX, ''); | |
| 119 | + window.open(path); | |
| 120 | + return; | |
| 121 | + } | |
| 116 | 122 | go(path); |
| 117 | 123 | } |
| 118 | 124 | ... | ... |
| ... | ... | @@ -6,6 +6,7 @@ import { cloneDeep, omit } from 'lodash-es'; |
| 6 | 6 | import { warn } from '/@/utils/log'; |
| 7 | 7 | import { createRouter, createWebHashHistory } from 'vue-router'; |
| 8 | 8 | |
| 9 | +export const OUTSIDE_LINK_PREFIX = '/outside/link'; | |
| 9 | 10 | export type LayoutMapKey = 'LAYOUT'; |
| 10 | 11 | const IFRAME = () => import('/@/views/sys/iframe/FrameBlank.vue'); |
| 11 | 12 | |
| ... | ... | @@ -81,6 +82,9 @@ export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModul |
| 81 | 82 | route.meta = meta; |
| 82 | 83 | } |
| 83 | 84 | } |
| 85 | + if (!route.path.startsWith('/') && route.meta.isLink) { | |
| 86 | + route.path = `${OUTSIDE_LINK_PREFIX}${route.path}`; | |
| 87 | + } | |
| 84 | 88 | route.children && asyncImportRoute(route.children); |
| 85 | 89 | }); |
| 86 | 90 | return routeList as unknown as T[]; | ... | ... |