Commit 843ec1e7 by Netfan Committed by GitHub

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

1 parent f20c5d9e
......@@ -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;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!