Browse Source

fix: isUrl func failed && support judge url with port

zhiyan 7 năm trước cách đây
mục cha
commit
9b08f2ea3e
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      src/utils/utils.js

+ 1 - 1
src/utils/utils.js

@@ -162,7 +162,7 @@ export function getRoutes(path, routerData) {
 }
 }
 
 
 /* eslint no-useless-escape:0 */
 /* eslint no-useless-escape:0 */
-const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/g;
+const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
 
 
 export function isUrl(path) {
 export function isUrl(path) {
   return reg.test(path);
   return reg.test(path);