Browse Source

chore: 优化url匹配参数支持替换${}

master
wangxiang 2 years ago
parent
commit
fcbb604ac8
  1. 2
      src/utils/is.ts

2
src/utils/is.ts

@ -101,7 +101,7 @@ export const isClient = !isServer; @@ -101,7 +101,7 @@ export const isClient = !isServer;
export function isUrl(path: string): boolean {
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_{\s\S}]*)#?(?:[\w]*))?)$/;
return reg.test(path);
}

Loading…
Cancel
Save