fix: 修复1:: 形式的ipv6校验失败的bug

This commit is contained in:
xiaojunnuo
2026-01-31 02:07:06 +08:00
parent 52cbff0e15
commit 8b96f218d5
6 changed files with 37 additions and 12 deletions
@@ -27,8 +27,12 @@ function openWindow(url: string, options: OpenWindowOptions = {}): void {
*/
function openRouteInNewWindow(path: string) {
const { hash, origin } = location;
let pathname = location.pathname;
if (pathname.endsWith("/")) {
pathname = pathname.slice(0, -1);
}
const fullPath = path.startsWith("/") ? path : `/${path}`;
const url = `${origin}${hash ? "/#" : ""}${fullPath}`;
const url = `${origin}${pathname}${hash ? "/#" : ""}${fullPath}`;
openWindow(url, { target: "_blank" });
}