This commit is contained in:
dap
2024-10-23 07:49:10 +08:00
13 changed files with 95 additions and 28 deletions

View File

@@ -4,7 +4,7 @@ import type { Router, RouteRecordNormalized } from 'vue-router';
import { toRaw } from 'vue';
import {
openWindow,
openRouteInNewWindow,
startProgress,
stopProgress,
} from '@vben-core/shared/utils';
@@ -290,11 +290,7 @@ export const useTabbarStore = defineStore('core-tabbar', {
* @param tab
*/
async openTabInNewWindow(tab: TabDefinition) {
const { hash, origin } = location;
const path = tab.fullPath || tab.path;
const fullPath = path.startsWith('/') ? path : `/${path}`;
const url = `${origin}${hash ? '/#' : ''}${fullPath}`;
openWindow(url, { target: '_blank' });
openRouteInNewWindow(tab.fullPath || tab.path);
},
/**
@@ -312,6 +308,14 @@ export const useTabbarStore = defineStore('core-tabbar', {
// this.addTab(tab);
this.tabs.splice(index, 1, tab);
}
// 过滤固定tabs后面更改affixTabOrder的值的话可能会有问题目前行464排序affixTabs没有设置值
const affixTabs = this.tabs.filter((tab) => isAffixTab(tab));
// 获得固定tabs的index
const newIndex = affixTabs.findIndex(
(item) => getTabPath(item) === getTabPath(tab),
);
// 交换位置重新排序
await this.sortTabs(index, newIndex);
},
/**
@@ -419,6 +423,12 @@ export const useTabbarStore = defineStore('core-tabbar', {
// this.addTab(tab);
this.tabs.splice(index, 1, tab);
}
// 过滤固定tabs后面更改affixTabOrder的值的话可能会有问题目前行464排序affixTabs没有设置值
const affixTabs = this.tabs.filter((tab) => isAffixTab(tab));
// 获得固定tabs的index,使用固定tabs的下一个位置也就是活动tabs的第一个位置
const newIndex = affixTabs.length;
// 交换位置重新排序
await this.sortTabs(index, newIndex);
},
/**