增加关闭当前标签页的方法

This commit is contained in:
lin-xin 2019-01-08 11:40:35 +08:00
parent 52f9f419e0
commit 4ff06b7b9f
2 changed files with 17 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
node_modules
/dist
example.html
favicon.ico
# local env files
.env.local
.env.*.local

View File

@ -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);
}
}
})
}
}