From 4ff06b7b9ff149bbff2367bde8813fead7b660c6 Mon Sep 17 00:00:00 2001 From: lin-xin <2981207131@qq.com> Date: Tue, 8 Jan 2019 11:40:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=B3=E9=97=AD=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=A0=87=E7=AD=BE=E9=A1=B5=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/components/common/Tags.vue | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.gitignore b/.gitignore index 11f3510..1c3aae3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules /dist example.html +favicon.ico # local env files .env.local .env.*.local diff --git a/src/components/common/Tags.vue b/src/components/common/Tags.vue index da724e4..f299331 100644 --- a/src/components/common/Tags.vue +++ b/src/components/common/Tags.vue @@ -89,6 +89,22 @@ }, created(){ this.setTags(this.$route); + // 监听关闭当前页面的标签页 + bus.$on('close_current_tags', () => { + for (let i = 0, len = this.tagsList.length; i < len; i++) { + const item = this.tagsList[i]; + if(item.path === this.$route.fullPath){ + if(i < len - 1){ + this.$router.push(this.tagsList[i+1].path); + }else if(i > 0){ + this.$router.push(this.tagsList[i-1].path); + }else{ + this.$router.push('/'); + } + this.tagsList.splice(i, 1); + } + } + }) } }