From 275ad9f14e8fa75620ff35c906c06c616fb2104f Mon Sep 17 00:00:00 2001 From: vben Date: Sun, 1 Nov 2020 12:27:15 +0800 Subject: [PATCH] fix: fix the problem of closing multiple tabs --- CHANGELOG.zh_CN.md | 1 + src/layouts/default/index.less | 7 ++----- src/layouts/default/multitabs/useTabDropdown.ts | 4 ++-- src/utils/helper/routeHelper.ts | 4 ---- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 84a8968a..73e203b7 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -13,6 +13,7 @@ - 修复 mock 分页工具错误 - 修复表格开启搜索表单折叠问题 - 修复表格 size 为 samll 时候,fixed 列样式问题 +- 修复多标签页关闭报错问题 ## 2.0.0-rc.7 (2020-10-31) diff --git a/src/layouts/default/index.less b/src/layouts/default/index.less index c5a7b3cf..696c6b03 100644 --- a/src/layouts/default/index.less +++ b/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; } diff --git a/src/layouts/default/multitabs/useTabDropdown.ts b/src/layouts/default/multitabs/useTabDropdown.ts index ad786bca..bfa03503 100644 --- a/src/layouts/default/multitabs/useTabDropdown.ts +++ b/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; diff --git a/src/utils/helper/routeHelper.ts b/src/utils/helper/routeHelper.ts index 3927d319..4cce1ebd 100644 --- a/src/utils/helper/routeHelper.ts +++ b/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}`; }); -- GitLab