Commit 6b7f688eaf08184272fc625ca7e7665384641714
1 parent
7f6f8eef
fix(menu): ensure that the external link jumps correctly, fix #516
Showing
2 changed files
with
10 additions
and
3 deletions
src/components/SimpleMenu/src/SimpleMenu.vue
@@ -20,6 +20,7 @@ | @@ -20,6 +20,7 @@ | ||
20 | <script lang="ts"> | 20 | <script lang="ts"> |
21 | import type { MenuState } from './types'; | 21 | import type { MenuState } from './types'; |
22 | import type { Menu as MenuType } from '/@/router/types'; | 22 | import type { Menu as MenuType } from '/@/router/types'; |
23 | + import type { RouteLocationNormalizedLoaded } from 'vue-router'; | ||
23 | 24 | ||
24 | import { defineComponent, computed, ref, unref, reactive, toRefs, watch } from 'vue'; | 25 | import { defineComponent, computed, ref, unref, reactive, toRefs, watch } from 'vue'; |
25 | import { useDesign } from '/@/hooks/web/useDesign'; | 26 | import { useDesign } from '/@/hooks/web/useDesign'; |
@@ -29,8 +30,9 @@ | @@ -29,8 +30,9 @@ | ||
29 | import { listenerRouteChange } from '/@/logics/mitt/routeChange'; | 30 | import { listenerRouteChange } from '/@/logics/mitt/routeChange'; |
30 | import { propTypes } from '/@/utils/propTypes'; | 31 | import { propTypes } from '/@/utils/propTypes'; |
31 | import { REDIRECT_NAME } from '/@/router/constant'; | 32 | import { REDIRECT_NAME } from '/@/router/constant'; |
32 | - import { RouteLocationNormalizedLoaded, useRouter } from 'vue-router'; | ||
33 | - import { isFunction } from '/@/utils/is'; | 33 | + import { useRouter } from 'vue-router'; |
34 | + import { isFunction, isUrl } from '/@/utils/is'; | ||
35 | + import { openWindow } from '/@/utils'; | ||
34 | 36 | ||
35 | import { useOpenKeys } from './useOpenKeys'; | 37 | import { useOpenKeys } from './useOpenKeys'; |
36 | export default defineComponent({ | 38 | export default defineComponent({ |
@@ -127,11 +129,16 @@ | @@ -127,11 +129,16 @@ | ||
127 | } | 129 | } |
128 | 130 | ||
129 | async function handleSelect(key: string) { | 131 | async function handleSelect(key: string) { |
132 | + if (isUrl(key)) { | ||
133 | + openWindow(key); | ||
134 | + return; | ||
135 | + } | ||
130 | const { beforeClickFn } = props; | 136 | const { beforeClickFn } = props; |
131 | if (beforeClickFn && isFunction(beforeClickFn)) { | 137 | if (beforeClickFn && isFunction(beforeClickFn)) { |
132 | const flag = await beforeClickFn(key); | 138 | const flag = await beforeClickFn(key); |
133 | if (!flag) return; | 139 | if (!flag) return; |
134 | } | 140 | } |
141 | + | ||
135 | emit('menuClick', key); | 142 | emit('menuClick', key); |
136 | 143 | ||
137 | isClickGo.value = true; | 144 | isClickGo.value = true; |
src/layouts/default/sider/MixSider.vue
@@ -86,7 +86,7 @@ | @@ -86,7 +86,7 @@ | ||
86 | 86 | ||
87 | import { ScrollContainer } from '/@/components/Container'; | 87 | import { ScrollContainer } from '/@/components/Container'; |
88 | import { SimpleMenuTag } from '/@/components/SimpleMenu'; | 88 | import { SimpleMenuTag } from '/@/components/SimpleMenu'; |
89 | - import Icon from '/@/components/Icon'; | 89 | + import { Icon } from '/@/components/Icon'; |
90 | import { AppLogo } from '/@/components/Application'; | 90 | import { AppLogo } from '/@/components/Application'; |
91 | import Trigger from '../trigger/HeaderTrigger.vue'; | 91 | import Trigger from '../trigger/HeaderTrigger.vue'; |
92 | 92 |