fix: 路由父级的记录改为全局 修复点击选项卡X无法跳转到正确来源的bug

This commit is contained in:
gaoyunqi
2024-04-25 10:43:33 +08:00
parent d6cdb7ee26
commit b58e013957
6 changed files with 15 additions and 13 deletions

View File

@ -184,7 +184,7 @@ export const useMultipleTabStore = defineStore({
}
},
async closeTab(tab: RouteLocationNormalized, router: Router, backTo: String) {
async closeTab(tab: RouteLocationNormalized, router: Router) {
const close = (route: RouteLocationNormalized) => {
const { fullPath, meta: { affix } = {} } = route;
if (affix) {
@ -207,6 +207,8 @@ export const useMultipleTabStore = defineStore({
let toTarget: RouteLocationRaw = {};
const index = this.tabList.findIndex((item) => item.path === path);
const backTo = window.fcd.routeBackMapping[tab.path];
delete window.fcd.routeBackMapping[tab.path];
const backToIndex = backTo ? this.tabList.findIndex((item) => item.path === backTo) : -1;
// If the current is the leftmost tab