Skip to content

Commit a65a822

Browse files
gee1kdterazhao
authored andcommitted
fix: 修复在 hash 路由模式下无法在新窗口打开路由的问题 (vbenjs#6652)
此问题是由于 PR vbenjs#6583 中新增的 `resolveHref` 函数导致的。其在 hash 路由模式下,得到的 URL 会包含 #/ 前缀。在经过 openRouteInNewWindow 的逻辑后就会出现两次 /# 前缀
1 parent ca72824 commit a65a822

File tree

1 file changed

+1
-1
lines changed
  • packages/@core/base/shared/src/utils

1 file changed

+1
-1
lines changed

packages/@core/base/shared/src/utils/window.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function openWindow(url: string, options: OpenWindowOptions = {}): void {
3030
function openRouteInNewWindow(path: string) {
3131
const { hash, origin } = location;
3232
const fullPath = path.startsWith('/') ? path : `/${path}`;
33-
const url = `${origin}${hash ? '/#' : ''}${fullPath}`;
33+
const url = `${origin}${hash && !fullPath.startsWith('/#') ? '/#' : ''}${fullPath}`;
3434
openWindow(url, { target: '_blank' });
3535
}
3636

0 commit comments

Comments
 (0)