fix(菜单): 点击已激活菜单也跳转到菜单下首页
This commit is contained in:
parent
62d06d71f3
commit
1c72e4cff1
|
@ -1,6 +1,6 @@
|
||||||
<script lang="tsx">
|
<script lang="tsx">
|
||||||
import { computed, defineComponent, h, ref } from 'vue';
|
import { computed, defineComponent, h, ref } from 'vue';
|
||||||
import { RouteRecordRaw, useRoute, useRouter } from 'vue-router';
|
import { RouteRecordRaw, useRouter } from 'vue-router';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import { cloneDeep, debounce } from 'lodash-es';
|
import { cloneDeep, debounce } from 'lodash-es';
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { logout } = useUser();
|
const { logout } = useUser();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
|
||||||
// @desc: 初始化配置的项目模块
|
// @desc: 初始化配置的项目模块
|
||||||
appStore.getProjectInfos();
|
appStore.getProjectInfos();
|
||||||
const { menuTree } = useMenuTree();
|
const { menuTree } = useMenuTree();
|
||||||
|
@ -58,14 +57,6 @@
|
||||||
selectedKey.value = [item.name as string];
|
selectedKey.value = [item.name as string];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 已激活的菜单重复点击不处理
|
|
||||||
if (
|
|
||||||
route.name === item.name ||
|
|
||||||
((route.name as string).includes(item.name as string) && route.meta?.hideChildrenInMenu)
|
|
||||||
) {
|
|
||||||
selectedKey.value = [item.name as string];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (item.meta?.hideChildrenInMenu) {
|
if (item.meta?.hideChildrenInMenu) {
|
||||||
// 顶级菜单路由跳转到该菜单下有权限的第一个顶部子菜单
|
// 顶级菜单路由跳转到该菜单下有权限的第一个顶部子菜单
|
||||||
const childName = getFirstRouterNameByCurrentRoute(item.name as string);
|
const childName = getFirstRouterNameByCurrentRoute(item.name as string);
|
||||||
|
|
Loading…
Reference in New Issue