From 3ad433a50b4428a6ed013c12e878e34cddcf71ba Mon Sep 17 00:00:00 2001 From: Svend Date: Tue, 19 Aug 2025 16:47:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=20hash=20?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=9C=A8=E6=96=B0=E7=AA=97=E5=8F=A3=E6=89=93=E5=BC=80=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E7=9A=84=E9=97=AE=E9=A2=98=20(#6652)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此问题是由于 PR #6583 中新增的 `resolveHref` 函数导致的。其在 hash 路由模式下,得到的 URL 会包含 #/ 前缀。在经过 openRouteInNewWindow 的逻辑后就会出现两次 /# 前缀 --- packages/@core/base/shared/src/utils/window.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@core/base/shared/src/utils/window.ts b/packages/@core/base/shared/src/utils/window.ts index 4608f4be9..2d8697dee 100644 --- a/packages/@core/base/shared/src/utils/window.ts +++ b/packages/@core/base/shared/src/utils/window.ts @@ -30,7 +30,7 @@ function openWindow(url: string, options: OpenWindowOptions = {}): void { function openRouteInNewWindow(path: string) { const { hash, origin } = location; const fullPath = path.startsWith('/') ? path : `/${path}`; - const url = `${origin}${hash ? '/#' : ''}${fullPath}`; + const url = `${origin}${hash && !fullPath.startsWith('/#') ? '/#' : ''}${fullPath}`; openWindow(url, { target: '_blank' }); }