From 895352ad221f91bdb57fdfd0396925fb7901c2df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jackhoo=28=E8=83=A1=E5=BD=AA=29?= <1679575151@qq.com> Date: Sat, 25 Nov 2023 14:47:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(breadcrumb):=20=E4=BF=AE=E5=A4=8D=E9=9D=A2?= =?UTF-8?q?=E5=8C=85=E5=B1=91=E8=B7=B3=E8=BD=AC=E5=A4=96=E9=93=BE=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=BD=93=E5=89=8D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?404=E9=97=AE=E9=A2=98=20(#3337).=20close=20#3336?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: jackhoo_98 --- src/hooks/web/usePage.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/hooks/web/usePage.ts b/src/hooks/web/usePage.ts index 1b43d59eb6e..9e788205186 100644 --- a/src/hooks/web/usePage.ts +++ b/src/hooks/web/usePage.ts @@ -5,6 +5,8 @@ import { unref } from 'vue'; import { useRouter } from 'vue-router'; import { REDIRECT_NAME } from '@/router/constant'; +import { isHttpUrl } from '@/utils/is'; +import { openWindow } from '@/utils'; export type PathAsPageEnum = T extends { path: string } ? T & { path: PageEnum } : T; export type RouteLocationRawEx = PathAsPageEnum; @@ -22,6 +24,13 @@ export function useGo(_router?: Router) { 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;