fix(菜单): 点击已激活菜单也跳转到菜单下首页

This commit is contained in:
baiqi 2024-07-24 15:15:31 +08:00 committed by 刘瑞斌
parent 62d06d71f3
commit 1c72e4cff1
1 changed files with 1 additions and 10 deletions

View File

@ -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);