mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-12-22 23:06:32 +08:00
fix: 修复多级菜单高亮问题 (#459)
This commit is contained in:
parent
4293d30180
commit
ba9a918d99
|
@ -38,7 +38,6 @@ const props = defineProps({
|
|||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const active = computed(() => getActive());
|
||||
|
||||
const list = computed(() => {
|
||||
|
@ -85,9 +84,16 @@ const getHref = (item: MenuRoute) => {
|
|||
};
|
||||
|
||||
const getPath = (item: ListItemType) => {
|
||||
const activeLevel = active.value.split('/').length;
|
||||
const pathLevel = item.path.split('/').length;
|
||||
if (activeLevel > pathLevel && active.value.startsWith(item.path)) {
|
||||
return active.value;
|
||||
}
|
||||
|
||||
if (active.value === item.path) {
|
||||
return active.value;
|
||||
}
|
||||
|
||||
return item.meta?.single ? item.redirect : item.path;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user