浏览代码

fix(store): addTab fx (#607)

在更新tabList的时候也能同时更新cacheTab
HUCHAOQI 4 年之前
父节点
当前提交
336be680d3
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/store/modules/multipleTab.ts

+ 3 - 3
src/store/modules/multipleTab.ts

@@ -136,10 +136,10 @@ export const useMultipleTabStore = defineStore({
         curTab.query = query || curTab.query;
         curTab.query = query || curTab.query;
         curTab.fullPath = fullPath || curTab.fullPath;
         curTab.fullPath = fullPath || curTab.fullPath;
         this.tabList.splice(updateIndex, 1, curTab);
         this.tabList.splice(updateIndex, 1, curTab);
-        return;
+      } else {
+        // Add tab
+        this.tabList.push(route);
       }
       }
-      // Add tab
-      this.tabList.push(route);
       this.updateCacheTab();
       this.updateCacheTab();
       cacheTab && Persistent.setLocal(MULTIPLE_TABS_KEY, this.tabList);
       cacheTab && Persistent.setLocal(MULTIPLE_TABS_KEY, this.tabList);
     },
     },