fix: 修复在 hash 路由模式下无法在新窗口打开路由的问题 (#6652)
此问题是由于 PR #6583 中新增的 `resolveHref` 函数导致的。其在 hash 路由模式下,得到的 URL 会包含 #/ 前缀。在经过 openRouteInNewWindow 的逻辑后就会出现两次 /# 前缀pull/201/head^2
parent
8ac2db5b7c
commit
3ad433a50b
|
@ -30,7 +30,7 @@ function openWindow(url: string, options: OpenWindowOptions = {}): void {
|
||||||
function openRouteInNewWindow(path: string) {
|
function openRouteInNewWindow(path: string) {
|
||||||
const { hash, origin } = location;
|
const { hash, origin } = location;
|
||||||
const fullPath = path.startsWith('/') ? path : `/${path}`;
|
const fullPath = path.startsWith('/') ? path : `/${path}`;
|
||||||
const url = `${origin}${hash ? '/#' : ''}${fullPath}`;
|
const url = `${origin}${hash && !fullPath.startsWith('/#') ? '/#' : ''}${fullPath}`;
|
||||||
openWindow(url, { target: '_blank' });
|
openWindow(url, { target: '_blank' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue