Unverified 提交 6f5711b0 作者: Wit〆苗大 提交者: GitHub

fix(is.ts): 修复isUrl正则不能匹配到 hash模式的外链 的问题 (#2051)

Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
上级 bc55b92c
...@@ -94,6 +94,6 @@ export const isClient = !isServer; ...@@ -94,6 +94,6 @@ export const isClient = !isServer;
export function isUrl(path: string): boolean { export function isUrl(path: string): boolean {
const reg = const reg =
/^(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; /^(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?(\/#\/)?(?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
return reg.test(path); return reg.test(path);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论