Pārlūkot izejas kodu

fix: 修复在 hash 路由模式下无法在新窗口打开路由的问题 (#6652)

此问题是由于 PR #6583 中新增的 `resolveHref` 函数导致的。其在 hash 路由模式下,得到的 URL 会包含 #/ 前缀。在经过 openRouteInNewWindow 的逻辑后就会出现两次 /# 前缀
Svend 1 mēnesi atpakaļ
vecāks
revīzija
3ad433a50b
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      packages/@core/base/shared/src/utils/window.ts

+ 1 - 1
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' });
 }