From 895352ad221f91bdb57fdfd0396925fb7901c2df Mon Sep 17 00:00:00 2001
From: jackhoo(胡彪) <1679575151@qq.com>
Date: 星期六, 25 十一月 2023 14:47:03 +0800
Subject: [PATCH] fix(breadcrumb): 修复面包屑跳转外链时,导致当前页面404问题 (#3337). close #3336

---
 src/hooks/web/usePage.ts |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/hooks/web/usePage.ts b/src/hooks/web/usePage.ts
index 1b43d59..9e78820 100644
--- a/src/hooks/web/usePage.ts
+++ b/src/hooks/web/usePage.ts
@@ -5,6 +5,8 @@
 
 import { useRouter } from 'vue-router';
 import { REDIRECT_NAME } from '@/router/constant';
+import { isHttpUrl } from '@/utils/is';
+import { openWindow } from '@/utils';
 
 export type PathAsPageEnum<T> = T extends { path: string } ? T & { path: PageEnum } : T;
 export type RouteLocationRawEx = PathAsPageEnum<RouteLocationRaw>;
@@ -22,6 +24,13 @@
     if (!opt) {
       return;
     }
+    let path = unref(opt) as string;
+    if (path[0] === '/') {
+      path = path.slice(1);
+    }
+    if (isHttpUrl(path)) {
+      return openWindow(path);
+    }
     isReplace ? replace(opt).catch(handleError) : push(opt).catch(handleError);
   }
   return go;

--
Gitblit v1.8.0