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) {
if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) {
if (Object.keys(route.query).length > 0) {
return isEqual(route.query, item.query) ? previous : next;
} else {
return isEqual(route.params, item.params) ? previous : next;
}
} else {
return route.path === item.path ? previous : next;
}
const isSamePath = route.path === item.path;
const hasQuery = Object.keys(route.query).length > 0;
const isSameData = hasQuery
? isEqual(route.query, item.query)
: isEqual(route.params, item.params);
return isSamePath ? (isSameData ? previous : next) : next;
}
const iconIsActive = computed(() => {