Browse Source

!20 调整了useGo方法

Merge pull request !20 from 紫星/master
main
xingyu 2 years ago committed by Gitee
parent
commit
49aa7f645c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
  1. 6
      src/hooks/web/usePage.ts

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