mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 08:36:19 +08:00
feat: menu routing support opens in a new window (#4715)
This commit is contained in:
@@ -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 };
|
||||
|
Reference in New Issue
Block a user