Skip to content

Commit

Permalink
feat: 迭代开发
Browse files Browse the repository at this point in the history
  • Loading branch information
lhbxs committed Jun 30, 2023
1 parent 5972276 commit 1785210
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { isObject } from './utils';
import { Schema } from '../../index';
import { RuleItem, RuleType } from 'async-validator';
import { orderBy } from 'lodash-es';
import { isUrl } from '../../utils';

// 校验时间格式
function validatorTime(value?: string) {
Expand Down Expand Up @@ -78,7 +79,11 @@ function validatorImage(value?: string) {

// 从0.x迁移过来的正则
const imagePattern = '([/|.|w|s|-])*.(?:jpg|gif|png|bmp|apng|webp|jpeg|json)';
return new RegExp(imagePattern).test(value);

// image 里也可以填写网络链接
const _isUrl = isUrl(value);
const _isImg = new RegExp(imagePattern).test(value);
return _isUrl || _isImg;
}

// 将x-render的schema转为async-validator的格式
Expand Down

0 comments on commit 1785210

Please sign in to comment.