liu
2026-09-30 0e556314c63ce6647c8e09208d60922590144922
src/packages/@core/base/shared/src/utils/util.ts
@@ -67,7 +67,11 @@
  urlStr: string = location.href,
): string {
  if (!urlStr || !key) return '';
  const url = new URL(decodeURIComponent(urlStr));
  // hash 路由(生产构建 VITE_ROUTER_HISTORY=hash)下,? 后面的参数落在 URL 的 fragment 里,
  // URL.searchParams 读不到,参数会被误判成"丢失"。这里先摘掉 # 再解析;
  // history 模式下地址里没有 #,走原逻辑,行为不变。
  const normalized = urlStr.includes('#') ? urlStr.replace('#', '') : urlStr;
  const url = new URL(decodeURIComponent(normalized));
  return url.searchParams.get(key) ?? '';
}