Browse Source

fix(@vben/stores): respect base URL when opening route in new window (#7837)

* fix(@vben/stores): respect base URL when opening route in new window

* fix(@vben/stores): respect base URL when opening route in new window
pull/7873/head
leo 5 months ago
committed by GitHub
parent
commit
9a73e961fc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      packages/effects/hooks/src/use-tabs.ts
  2. 7
      packages/stores/src/modules/tabbar.ts

2
packages/effects/hooks/src/use-tabs.ts

@ -47,7 +47,7 @@ export function useTabs() {
}
async function openTabInNewWindow(tab?: RouteLocationNormalized) {
await tabbarStore.openTabInNewWindow(tab || route);
await tabbarStore.openTabInNewWindow(tab || route, router);
}
async function closeTabByKey(key: string) {

7
packages/stores/src/modules/tabbar.ts

@ -14,7 +14,7 @@ import { markRaw, toRaw } from 'vue';
import { preferences } from '@vben-core/preferences';
import {
createStack,
openRouteInNewWindow,
openWindow,
Stack,
startProgress,
stopProgress,
@ -371,8 +371,9 @@ export const useTabbarStore = defineStore('core-tabbar', {
* @zh_CN
* @param tab
*/
async openTabInNewWindow(tab: TabDefinition) {
openRouteInNewWindow(tab.fullPath || tab.path);
async openTabInNewWindow(tab: TabDefinition, router: Router) {
const href = router.resolve(tab.fullPath || tab.path).href;
openWindow(new URL(href, location.href).href, { target: '_blank' });
},
/**

Loading…
Cancel
Save