mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-09-16 11:34:55 +08:00
fix: 修复不同路由使用相同参数时,多个标签页会同时被激活的问题
This commit is contained in:
parent
acf15af930
commit
b4efe3758d
@ -114,14 +114,21 @@ export function useTags() {
|
||||
]);
|
||||
|
||||
function conditionHandle(item, previous, next) {
|
||||
const currentName = route.name || "";
|
||||
const itemName = item.name || "";
|
||||
|
||||
if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) {
|
||||
if (Object.keys(route.query).length > 0) {
|
||||
return isEqual(route.query, item.query) ? previous : next;
|
||||
return currentName === itemName && isEqual(route.query, item.query)
|
||||
? previous
|
||||
: next;
|
||||
} else {
|
||||
return isEqual(route.params, item.params) ? previous : next;
|
||||
return currentName === itemName && isEqual(route.params, item.params)
|
||||
? previous
|
||||
: next;
|
||||
}
|
||||
} else {
|
||||
return route.path === item.path ? previous : next;
|
||||
return currentName === itemName ? previous : next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,22 +80,15 @@ export const useMultiTagsStore = defineStore("pure-multiTags", {
|
||||
if (isBoolean(tagVal?.meta?.showLink) && !tagVal?.meta?.showLink)
|
||||
return;
|
||||
const tagPath = tagVal.path;
|
||||
// 判断tag是否已存在
|
||||
const tagHasExits = this.multiTags.some(tag => {
|
||||
return tag.path === tagPath;
|
||||
return (
|
||||
tag.path === tagPath &&
|
||||
isEqual(tag?.query, tagVal?.query) &&
|
||||
isEqual(tag?.params, tagVal?.params)
|
||||
);
|
||||
});
|
||||
|
||||
// 判断tag中的query键值是否相等
|
||||
const tagQueryHasExits = this.multiTags.some(tag => {
|
||||
return isEqual(tag?.query, tagVal?.query);
|
||||
});
|
||||
|
||||
// 判断tag中的params键值是否相等
|
||||
const tagParamsHasExits = this.multiTags.some(tag => {
|
||||
return isEqual(tag?.params, tagVal?.params);
|
||||
});
|
||||
|
||||
if (tagHasExits && tagQueryHasExits && tagParamsHasExits) return;
|
||||
if (tagHasExits) return;
|
||||
|
||||
// 动态路由可打开的最大数量
|
||||
const dynamicLevel = tagVal?.meta?.dynamicLevel ?? -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user