From 28be6aaa0beefc9b9ff94c19d089a96da32ecece Mon Sep 17 00:00:00 2001 From: sakuya <81883387@qq.com> Date: Sun, 7 Nov 2021 18:48:45 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E6=A0=87=E7=AD=BE=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E7=9A=84=E5=87=BD=E6=95=B0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/tags.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/layout/components/tags.vue b/src/layout/components/tags.vue index f7c5e33b..03f1064e 100644 --- a/src/layout/components/tags.vue +++ b/src/layout/components/tags.vue @@ -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