fix: Fixed tab error,fixex #59 [deploy]

This commit is contained in:
vben
2024-07-29 23:46:22 +08:00
parent 239f681ea1
commit a80a9135fc
6 changed files with 125 additions and 49 deletions

View File

@@ -34,7 +34,8 @@ const {
} = useTabbar();
const menus = computed(() => {
const menus = createContextMenus(route);
const tab = coreTabbarStore.getTabByPath(currentActive.value);
const menus = createContextMenus(tab);
return menus.map((item) => {
return {
...item,

View File

@@ -182,7 +182,6 @@ export const useCoreTabbarStore = defineStore('core-tabbar', {
}
await this._bulkCloseByPaths(paths);
},
/**
* @zh_CN 关闭右侧标签页
* @param tab
@@ -251,6 +250,17 @@ export const useCoreTabbarStore = defineStore('core-tabbar', {
await this.closeTab(this.tabs[index], router);
},
/**
* 根据路径获取标签页
* @param path
* @returns
*/
getTabByPath(path: string) {
return this.getTabs.find(
(item) => getTabPath(item) === path,
) as TabDefinition;
},
/**
* @zh_CN 新窗口打开标签页
* @param tab