fixed: 进入404页面不会触发获取菜单.

This commit is contained in:
lijiahang
2023-08-15 18:34:09 +08:00
parent fa8dc6d8fa
commit 4facfc66cd
12 changed files with 54 additions and 22 deletions

View File

@@ -33,13 +33,22 @@
/**
* 跳转
*/
const goto = (item: RouteRecordRaw) => {
const goto = (e: any, item: RouteRecordRaw) => {
//
if (regexUrl.test(item.path)) {
openWindow(item.path);
selectedKey.value = [item.name as string];
return;
}
//
if (e.ctrlKey) {
const { href } = router.resolve({
name: item.name,
});
openWindow(href);
selectedKey.value = [item.name as string];
return;
}
// selectedKey
const { hideInMenu, activeMenu } = item.meta as RouteMeta;
if (route.name === item.name && !hideInMenu && !activeMenu) {
@@ -124,7 +133,7 @@
<a-menu-item
key={element?.name}
v-slots={{ icon }}
onClick={() => goto(element)}
onClick={($event: any) => goto($event, element)}
>
{element?.meta?.locale || ''}
</a-menu-item>

View File

@@ -192,7 +192,7 @@
import useLocale from '@/hooks/locale';
import useUser from '@/hooks/user';
import { triggerMouseEvent } from '@/utils';
import Menu from '@/components/menu/index.vue';
import Menu from '@/components/menu/tree/index.vue';
import MessageBox from '../message-box/index.vue';
const appStore = useAppStore();