From 45604f5703d485fc65e5a7d6d69aa88dbb9dbb8a Mon Sep 17 00:00:00 2001 From: "LAPTOP-CNV4CMCJ\\cheng" <1315228474@qq.com> Date: Fri, 9 Jun 2023 17:55:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E4=BA=86useGo?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E8=AE=A9=E8=8F=9C=E5=8D=95=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=B7=B3=E8=BD=AC=E5=88=B0=E5=A4=96=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/web/usePage.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/web/usePage.ts b/src/hooks/web/usePage.ts index 4032cc92..27349fa1 100644 --- a/src/hooks/web/usePage.ts +++ b/src/hooks/web/usePage.ts @@ -22,7 +22,11 @@ export function useGo(_router?: Router) { if (!opt) { return } - isReplace ? replace(opt).catch(handleError) : push(opt).catch(handleError) + if (/^(https?:|mailto:|tel:)/.test(opt as string)) { + window.open(opt as string, '_blank', 'noopener=yes') + } else { + isReplace ? replace(opt).catch(handleError) : push(opt).catch(handleError) + } } return go }