diff --git a/src/views/main-content.vue b/src/views/main-content.vue index de945201..c7597bbf 100644 --- a/src/views/main-content.vue +++ b/src/views/main-content.vue @@ -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' })