fix: tab close by key, fixed: #4132 (#4136)

This commit is contained in:
Netfan 2024-08-13 11:49:02 +08:00 committed by GitHub
parent f20c5d9e2e
commit 843ec1e749
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}