Просмотр исходного кода

修复tabs关闭最后一个tab后,再次打开会保留最后一个tab bug

daxiongYang лет назад: 6
Родитель
Сommit
47703701bf
1 измененных файлов с 3 добавлено и 4 удалено
  1. 3 4
      src/views/main-content.vue

+ 3 - 4
src/views/main-content.vue

@ -84,15 +84,14 @@
84 84
      },
85 85
      // tabs, 删除tab
86 86
      removeTabHandle (tabName) {
87
        var newTabs = this.mainTabs.filter(item => item.name !== tabName)
88
        if (newTabs.length >= 1) {
87
        this.mainTabs = this.mainTabs.filter(item => item.name !== tabName)
88
        if (this.mainTabs.length >= 1) {
89 89
          // 当前选中tab被删除
90 90
          if (tabName === this.mainTabsActiveName) {
91
            this.$router.push({ name: newTabs[newTabs.length - 1].name }, () => {
91
            this.$router.push({ name: this.mainTabs[this.mainTabs.length - 1].name }, () => {
92 92
              this.mainTabsActiveName = this.$route.name
93 93
            })
94 94
          }
95
          this.mainTabs = newTabs
96 95
        } else {
97 96
          this.menuActiveName = ''
98 97
          this.$router.push({ name: 'home' })