fix: 修复页面tag激活状态逻辑判断问题

- 当`showLink`为`false`,传递参数默认为空,当前页面路径为`/path1/index`,其余路径(`showLink:false`)为:`/path2/index`,`/path3/index`等都会显示激活状态
This commit is contained in:
ZM25XC 2024-06-08 17:08:23 +08:00 committed by GitHub
parent 8816e61e3a
commit 73f4febdc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -114,15 +114,12 @@ export function useTags() {
]); ]);
function conditionHandle(item, previous, next) { function conditionHandle(item, previous, next) {
if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) { const isSamePath = route.path === item.path;
if (Object.keys(route.query).length > 0) { const hasQuery = Object.keys(route.query).length > 0;
return isEqual(route.query, item.query) ? previous : next; const isSameData = hasQuery
} else { ? isEqual(route.query, item.query)
return isEqual(route.params, item.params) ? previous : next; : isEqual(route.params, item.params);
} return isSamePath ? (isSameData ? previous : next) : next;
} else {
return route.path === item.path ? previous : next;
}
} }
const iconIsActive = computed(() => { const iconIsActive = computed(() => {