Skip to content

Commit

Permalink
修复tabs关闭最后一个tab后,再次打开会保留最后一个tab bug
Browse files Browse the repository at this point in the history
  • Loading branch information
daxiongYang committed Jun 7, 2018
1 parent 82bff84 commit 4770370
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/views/main-content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@
},
// tabs, 删除tab
removeTabHandle (tabName) {
var newTabs = this.mainTabs.filter(item => item.name !== tabName)
if (newTabs.length >= 1) {
this.mainTabs = this.mainTabs.filter(item => item.name !== tabName)
if (this.mainTabs.length >= 1) {
// 当前选中tab被删除
if (tabName === this.mainTabsActiveName) {
this.$router.push({ name: newTabs[newTabs.length - 1].name }, () => {
this.$router.push({ name: this.mainTabs[this.mainTabs.length - 1].name }, () => {
this.mainTabsActiveName = this.$route.name
})
}
this.mainTabs = newTabs
} else {
this.menuActiveName = ''
this.$router.push({ name: 'home' })
Expand Down

0 comments on commit 4770370

Please # to comment.