!20 调整了useGo方法

Merge pull request !20 from 紫星/master
pull/24/MERGE
xingyu 2023-06-14 02:18:53 +00:00 committed by Gitee
commit 49aa7f645c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 5 additions and 1 deletions

View File

@ -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
}