revert: fix顶部菜单高亮 (#601)

This commit is contained in:
liweijie0812 2023-09-14 15:09:11 +08:00 committed by GitHub
parent d775bc3aa9
commit 9c3fbdd71b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,6 @@
import uniq from 'lodash/uniq';
import { createRouter, createWebHistory, RouteRecordRaw, useRoute } from 'vue-router';
import { useSettingStore } from '@/store';
const env = import.meta.env.MODE || 'development';
// 导入homepage相关固定路由
@ -62,16 +60,11 @@ export const getRoutesExpanded = () => {
export const getActive = (maxLevel = 3): string => {
const route = useRoute();
const settingStore = useSettingStore();
if (!route.path) {
return '';
}
if (settingStore.layout === 'top') {
return route.path.split('/').slice(0, 2).join('/');
}
return route.path
.split('/')
.filter((_item: string, index: number) => index <= maxLevel && index > 0)