mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 07:48:22 +08:00
revert: fix顶部菜单高亮 (#601)
This commit is contained in:
parent
d775bc3aa9
commit
9c3fbdd71b
|
@ -1,8 +1,6 @@
|
||||||
import uniq from 'lodash/uniq';
|
import uniq from 'lodash/uniq';
|
||||||
import { createRouter, createWebHistory, RouteRecordRaw, useRoute } from 'vue-router';
|
import { createRouter, createWebHistory, RouteRecordRaw, useRoute } from 'vue-router';
|
||||||
|
|
||||||
import { useSettingStore } from '@/store';
|
|
||||||
|
|
||||||
const env = import.meta.env.MODE || 'development';
|
const env = import.meta.env.MODE || 'development';
|
||||||
|
|
||||||
// 导入homepage相关固定路由
|
// 导入homepage相关固定路由
|
||||||
|
@ -62,16 +60,11 @@ export const getRoutesExpanded = () => {
|
||||||
|
|
||||||
export const getActive = (maxLevel = 3): string => {
|
export const getActive = (maxLevel = 3): string => {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const settingStore = useSettingStore();
|
|
||||||
|
|
||||||
if (!route.path) {
|
if (!route.path) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingStore.layout === 'top') {
|
|
||||||
return route.path.split('/').slice(0, 2).join('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
return route.path
|
return route.path
|
||||||
.split('/')
|
.split('/')
|
||||||
.filter((_item: string, index: number) => index <= maxLevel && index > 0)
|
.filter((_item: string, index: number) => index <= maxLevel && index > 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user