From 843ec1e7491b2969ab8a7bcd2966c831d2ad304a Mon Sep 17 00:00:00 2001 From: Netfan Date: Tue, 13 Aug 2024 11:49:02 +0800 Subject: [PATCH] fix: tab close by key, fixed: #4132 (#4136) --- packages/stores/src/modules/tabbar.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/stores/src/modules/tabbar.ts b/packages/stores/src/modules/tabbar.ts index c385ae97..a3738103 100644 --- a/packages/stores/src/modules/tabbar.ts +++ b/packages/stores/src/modules/tabbar.ts @@ -77,6 +77,7 @@ export const useTabbarStore = defineStore('core-tabbar', { /** * @zh_CN 跳转到标签页 * @param tab + * @param router */ async _goToTab(tab: TabDefinition, router: Router) { const { params, path, query } = tab; @@ -243,9 +244,13 @@ export const useTabbarStore = defineStore('core-tabbar', { /** * @zh_CN 通过key关闭标签页 * @param key + * @param router */ async closeTabByKey(key: string, router: Router) { - const index = this.tabs.findIndex((item) => getTabPath(item) === key); + const originKey = decodeURIComponent(key); + const index = this.tabs.findIndex( + (item) => getTabPath(item) === originKey, + ); if (index === -1) { return; }