feat: tab页允许手动修改标题 新建流程改为tab页而不是弹框

This commit is contained in:
gaoyunqi
2024-02-05 11:27:33 +08:00
parent 445292105f
commit ec11057a12
7 changed files with 606 additions and 37 deletions

View File

@ -165,12 +165,25 @@ export const useMultipleTabStore = defineStore({
index !== -1 && this.tabList.splice(index, 1);
}
}
this.tabList.push(route);
const _route = Object.assign(
{
tabKey: route?.query?.tabKey || `tab_${Math.round(Math.random() * 1000000)}`,
},
route,
);
this.tabList.push(_route);
}
this.updateCacheTab();
cacheTab && Persistent.setLocal(MULTIPLE_TABS_KEY, this.tabList);
},
changeTitle(tabKey: string, title: string) {
const tab = (this.tabList as any).find((item) => item.tabKey === tabKey);
if (tab) {
tab.tabTitle = title;
}
},
async closeTab(tab: RouteLocationNormalized, router: Router) {
const close = (route: RouteLocationNormalized) => {
const { fullPath, meta: { affix } = {} } = route;