瀏覽代碼

fix: fix the problem of closing multiple tabs

vben 4 年之前
父節點
當前提交
275ad9f14e

+ 1 - 0
CHANGELOG.zh_CN.md

@@ -13,6 +13,7 @@
 - 修复 mock 分页工具错误
 - 修复表格开启搜索表单折叠问题
 - 修复表格 size 为 samll 时候,fixed 列样式问题
+- 修复多标签页关闭报错问题
 
 ## 2.0.0-rc.7 (2020-10-31)
 

+ 2 - 5
src/layouts/default/index.less

@@ -312,10 +312,6 @@
     }
   }
 
-  &-lm {
-    display: flex;
-  }
-
   &__logo {
     padding: 0 10px;
   }
@@ -333,7 +329,8 @@
       display: flex;
       align-items: center;
       height: @header-height;
-      font-size: 1.1em;
+      padding: 0 2px;
+      font-size: 1.2em;
       cursor: pointer;
     }
 

+ 2 - 2
src/layouts/default/multitabs/useTabDropdown.ts

@@ -233,9 +233,9 @@ export function closeTab(closedTab: TabItem | AppRouteRecordRaw) {
     const page = unref(getTabsState)[index - 1];
     const { params, path, query } = page;
     toObj = {
-      params,
+      params: params || {},
       path,
-      query,
+      query: query || {},
     };
   }
   const route = (unref(currentRoute) as unknown) as AppRouteRecordRaw;

+ 0 - 4
src/utils/helper/routeHelper.ts

@@ -28,10 +28,6 @@ export function genRouteModule(moduleList: AppRouteModule[]) {
     const flatList = (toRaw(router.getRoutes()).filter(
       (item) => item.children.length === 0
     ) as unknown) as AppRouteRecordRaw[];
-    try {
-      (router as any) = null;
-    } catch (error) {}
-
     flatList.forEach((item) => {
       item.path = `${layout ? layout.path : ''}${item.path}`;
     });