ソースを参照

页签bug 修复

lilei 4 年 前
コミット
763dc44b6b
1 ファイル変更7 行追加1 行削除
  1. 7 1
      src/components/MultiTab/MultiTab.vue

+ 7 - 1
src/components/MultiTab/MultiTab.vue

@@ -123,13 +123,19 @@ export default {
   watch: {
     '$route': function (newVal) {
       this.activeKey = newVal.name
-      if (this.tabsList.indexOf(newVal.name) < 0) {
+      const index = this.tabsList.indexOf(newVal.name)
+      // 不存在
+      if (index < 0) {
         this.tabsList.push(newVal.name)
         this.pages.push(newVal)
+      } else {
+        // 已存在
+        this.pages.splice(index, 1, newVal)
       }
     },
     activeKey: function (newPathKey) {
       const row = this.pages.find(item => item.name == newPathKey)
+      console.log(row.fullPath)
       this.$router.push({ path: row.fullPath })
     }
   },