FIX 标签关闭其他的函数逻辑错误

This commit is contained in:
sakuya 2021-11-07 18:48:45 +08:00
parent 50202ba1f1
commit 28be6aaa0b
1 changed files with 10 additions and 3 deletions

View File

@ -109,11 +109,11 @@
return route.fullPath === this.$route.fullPath
},
//tag
closeSelectedTag(tag) {
closeSelectedTag(tag, autoPushLatestView=true) {
this.$store.commit("removeViewTags", tag)
this.$store.commit("removeIframeList", tag)
this.$store.commit("removeKeepLive", tag.name)
if (this.isActive(tag)) {
if (autoPushLatestView && this.isActive(tag)) {
const latestView = this.tagList.slice(-1)[0]
if (latestView) {
this.$router.push(latestView)
@ -176,12 +176,19 @@
//TAB
closeOtherTabs(){
var nowTag = this.contextMenuItem;
//
if(this.$route.fullPath != nowTag.fullPath){
this.$router.push({
path: nowTag.fullPath,
query: nowTag.query
})
}
var tags = [...this.tagList];
tags.forEach(tag => {
if(tag.meta&&tag.meta.affix || nowTag.fullPath==tag.fullPath){
return true
}else{
this.closeSelectedTag(tag)
this.closeSelectedTag(tag, false)
}
})
this.contextMenuVisible = false