File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -114,14 +114,21 @@ export function useTags() {
114114 ] ) ;
115115
116116 function conditionHandle ( item , previous , next ) {
117+ const currentName = route . name || "" ;
118+ const itemName = item . name || "" ;
119+
117120 if ( isBoolean ( route ?. meta ?. showLink ) && route ?. meta ?. showLink === false ) {
118121 if ( Object . keys ( route . query ) . length > 0 ) {
119- return isEqual ( route . query , item . query ) ? previous : next ;
122+ return currentName === itemName && isEqual ( route . query , item . query )
123+ ? previous
124+ : next ;
120125 } else {
121- return isEqual ( route . params , item . params ) ? previous : next ;
126+ return currentName === itemName && isEqual ( route . params , item . params )
127+ ? previous
128+ : next ;
122129 }
123130 } else {
124- return route . path === item . path ? previous : next ;
131+ return currentName === itemName ? previous : next ;
125132 }
126133 }
127134
Original file line number Diff line number Diff line change @@ -80,22 +80,15 @@ export const useMultiTagsStore = defineStore("pure-multiTags", {
8080 if ( isBoolean ( tagVal ?. meta ?. showLink ) && ! tagVal ?. meta ?. showLink )
8181 return ;
8282 const tagPath = tagVal . path ;
83- // 判断tag是否已存在
8483 const tagHasExits = this . multiTags . some ( tag => {
85- return tag . path === tagPath ;
84+ return (
85+ tag . path === tagPath &&
86+ isEqual ( tag ?. query , tagVal ?. query ) &&
87+ isEqual ( tag ?. params , tagVal ?. params )
88+ ) ;
8689 } ) ;
8790
88- // 判断tag中的query键值是否相等
89- const tagQueryHasExits = this . multiTags . some ( tag => {
90- return isEqual ( tag ?. query , tagVal ?. query ) ;
91- } ) ;
92-
93- // 判断tag中的params键值是否相等
94- const tagParamsHasExits = this . multiTags . some ( tag => {
95- return isEqual ( tag ?. params , tagVal ?. params ) ;
96- } ) ;
97-
98- if ( tagHasExits && tagQueryHasExits && tagParamsHasExits ) return ;
91+ if ( tagHasExits ) return ;
9992
10093 // 动态路由可打开的最大数量
10194 const dynamicLevel = tagVal ?. meta ?. dynamicLevel ?? - 1 ;
You can’t perform that action at this time.
0 commit comments