mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-01-24 04:10:20 +08:00
fix(menu): ensure that the external link jumps correctly, fix #516
This commit is contained in:
parent
7f6f8eefe9
commit
6b7f688eaf
@ -20,6 +20,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { MenuState } from './types';
|
import type { MenuState } from './types';
|
||||||
import type { Menu as MenuType } from '/@/router/types';
|
import type { Menu as MenuType } from '/@/router/types';
|
||||||
|
import type { RouteLocationNormalizedLoaded } from 'vue-router';
|
||||||
|
|
||||||
import { defineComponent, computed, ref, unref, reactive, toRefs, watch } from 'vue';
|
import { defineComponent, computed, ref, unref, reactive, toRefs, watch } from 'vue';
|
||||||
import { useDesign } from '/@/hooks/web/useDesign';
|
import { useDesign } from '/@/hooks/web/useDesign';
|
||||||
@ -29,8 +30,9 @@
|
|||||||
import { listenerRouteChange } from '/@/logics/mitt/routeChange';
|
import { listenerRouteChange } from '/@/logics/mitt/routeChange';
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
import { REDIRECT_NAME } from '/@/router/constant';
|
import { REDIRECT_NAME } from '/@/router/constant';
|
||||||
import { RouteLocationNormalizedLoaded, useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { isFunction } from '/@/utils/is';
|
import { isFunction, isUrl } from '/@/utils/is';
|
||||||
|
import { openWindow } from '/@/utils';
|
||||||
|
|
||||||
import { useOpenKeys } from './useOpenKeys';
|
import { useOpenKeys } from './useOpenKeys';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -127,11 +129,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleSelect(key: string) {
|
async function handleSelect(key: string) {
|
||||||
|
if (isUrl(key)) {
|
||||||
|
openWindow(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const { beforeClickFn } = props;
|
const { beforeClickFn } = props;
|
||||||
if (beforeClickFn && isFunction(beforeClickFn)) {
|
if (beforeClickFn && isFunction(beforeClickFn)) {
|
||||||
const flag = await beforeClickFn(key);
|
const flag = await beforeClickFn(key);
|
||||||
if (!flag) return;
|
if (!flag) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('menuClick', key);
|
emit('menuClick', key);
|
||||||
|
|
||||||
isClickGo.value = true;
|
isClickGo.value = true;
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
|
|
||||||
import { ScrollContainer } from '/@/components/Container';
|
import { ScrollContainer } from '/@/components/Container';
|
||||||
import { SimpleMenuTag } from '/@/components/SimpleMenu';
|
import { SimpleMenuTag } from '/@/components/SimpleMenu';
|
||||||
import Icon from '/@/components/Icon';
|
import { Icon } from '/@/components/Icon';
|
||||||
import { AppLogo } from '/@/components/Application';
|
import { AppLogo } from '/@/components/Application';
|
||||||
import Trigger from '../trigger/HeaderTrigger.vue';
|
import Trigger from '../trigger/HeaderTrigger.vue';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user