Commit 6b7f688eaf08184272fc625ca7e7665384641714

Authored by Vben
1 parent 7f6f8eef

fix(menu): ensure that the external link jumps correctly, fix #516

src/components/SimpleMenu/src/SimpleMenu.vue
... ... @@ -20,6 +20,7 @@
20 20 <script lang="ts">
21 21 import type { MenuState } from './types';
22 22 import type { Menu as MenuType } from '/@/router/types';
  23 + import type { RouteLocationNormalizedLoaded } from 'vue-router';
23 24  
24 25 import { defineComponent, computed, ref, unref, reactive, toRefs, watch } from 'vue';
25 26 import { useDesign } from '/@/hooks/web/useDesign';
... ... @@ -29,8 +30,9 @@
29 30 import { listenerRouteChange } from '/@/logics/mitt/routeChange';
30 31 import { propTypes } from '/@/utils/propTypes';
31 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 37 import { useOpenKeys } from './useOpenKeys';
36 38 export default defineComponent({
... ... @@ -127,11 +129,16 @@
127 129 }
128 130  
129 131 async function handleSelect(key: string) {
  132 + if (isUrl(key)) {
  133 + openWindow(key);
  134 + return;
  135 + }
130 136 const { beforeClickFn } = props;
131 137 if (beforeClickFn && isFunction(beforeClickFn)) {
132 138 const flag = await beforeClickFn(key);
133 139 if (!flag) return;
134 140 }
  141 +
135 142 emit('menuClick', key);
136 143  
137 144 isClickGo.value = true;
... ...
src/layouts/default/sider/MixSider.vue
... ... @@ -86,7 +86,7 @@
86 86  
87 87 import { ScrollContainer } from '/@/components/Container';
88 88 import { SimpleMenuTag } from '/@/components/SimpleMenu';
89   - import Icon from '/@/components/Icon';
  89 + import { Icon } from '/@/components/Icon';
90 90 import { AppLogo } from '/@/components/Application';
91 91 import Trigger from '../trigger/HeaderTrigger.vue';
92 92  
... ...