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

@@ -23,4 +23,15 @@ function openWindow(url: string, options: OpenWindowOptions = {}): void {
window.open(url, target, features);
}
export { openWindow };
/**
* 在新窗口中打开路由。
* @param path
*/
function openRouteInNewWindow(path: string) {
const { hash, origin } = location;
const fullPath = path.startsWith('/') ? path : `/${path}`;
const url = `${origin}${hash ? '/#' : ''}${fullPath}`;
openWindow(url, { target: '_blank' });
}
export { openRouteInNewWindow, openWindow };