fix: useGo use isurl

pull/24/MERGE
xingyu 2023-06-19 15:20:00 +08:00
parent 6a2e9e75c6
commit 3a504d441a
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import { unref } from 'vue'
import { useRouter } from 'vue-router'
import { REDIRECT_NAME } from '@/router/constant'
import { isUrl } from '@/utils/is'
export type PathAsPageEnum<T> = T extends { path: string } ? T & { path: PageEnum } : T
export type RouteLocationRawEx = PathAsPageEnum<RouteLocationRaw>
@ -22,7 +23,7 @@ export function useGo(_router?: Router) {
if (!opt) {
return
}
if (/^(https?:|mailto:|tel:)/.test(opt as string)) {
if (isUrl(opt as string)) {
window.open(opt as string, '_blank', 'noopener=yes')
} else {
isReplace ? replace(opt).catch(handleError) : push(opt).catch(handleError)