Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/layout/hooks/useTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
19 changes: 6 additions & 13 deletions src/store/modules/multiTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down