feat: 调整了useGo方法,让菜单可以跳转到外链接

pull/20/head
LAPTOP-CNV4CMCJ\cheng 2023-06-09 17:55:56 +08:00
parent f4346619d8
commit 45604f5703
1 changed files with 5 additions and 1 deletions

View File

@ -22,7 +22,11 @@ export function useGo(_router?: Router) {
if (!opt) { if (!opt) {
return 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 return go
} }