fixed: 进入404页面不会触发获取菜单.
This commit is contained in:
@@ -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>
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user