Commit 6f5711b0889f1e3c0e7a6c3b0701ff21dc9a3742
Committed by
GitHub
1 parent
bc55b92c
fix(is.ts): 修复isUrl正则不能匹配到 hash模式的外链 的问题 (#2051)
Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
Showing
1 changed file
with
1 additions
and
1 deletions
src/utils/is.ts
@@ -94,6 +94,6 @@ export const isClient = !isServer; | @@ -94,6 +94,6 @@ export const isClient = !isServer; | ||
94 | 94 | ||
95 | export function isUrl(path: string): boolean { | 95 | export function isUrl(path: string): boolean { |
96 | const reg = | 96 | const reg = |
97 | - /^(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; | 97 | + /^(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?(\/#\/)?(?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; |
98 | return reg.test(path); | 98 | return reg.test(path); |
99 | } | 99 | } |