Skip to content

Commit

Permalink
fix(menu): ensure that the external link jumps correctly, fix #516
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Apr 24, 2021
1 parent 7f6f8ee commit 6b7f688
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/components/SimpleMenu/src/SimpleMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<script lang="ts">
import type { MenuState } from './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 { useDesign } from '/@/hooks/web/useDesign';
Expand All @@ -29,8 +30,9 @@
import { listenerRouteChange } from '/@/logics/mitt/routeChange';
import { propTypes } from '/@/utils/propTypes';
import { REDIRECT_NAME } from '/@/router/constant';
import { RouteLocationNormalizedLoaded, useRouter } from 'vue-router';
import { isFunction } from '/@/utils/is';
import { useRouter } from 'vue-router';
import { isFunction, isUrl } from '/@/utils/is';
import { openWindow } from '/@/utils';
import { useOpenKeys } from './useOpenKeys';
export default defineComponent({
Expand Down Expand Up @@ -127,11 +129,16 @@
}
async function handleSelect(key: string) {
if (isUrl(key)) {
openWindow(key);
return;
}
const { beforeClickFn } = props;
if (beforeClickFn && isFunction(beforeClickFn)) {
const flag = await beforeClickFn(key);
if (!flag) return;
}
emit('menuClick', key);
isClickGo.value = true;
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/default/sider/MixSider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
import { ScrollContainer } from '/@/components/Container';
import { SimpleMenuTag } from '/@/components/SimpleMenu';
import Icon from '/@/components/Icon';
import { Icon } from '/@/components/Icon';
import { AppLogo } from '/@/components/Application';
import Trigger from '../trigger/HeaderTrigger.vue';
Expand Down

0 comments on commit 6b7f688

Please sign in to comment.