Merge pull request #1122 from 2betop/bugfix2

当 json-editor 字段配置 isJson 验证器且初始值不是字符串时验证失败
This commit is contained in:
RickCole 2020-12-01 14:19:07 +08:00 committed by GitHub
commit 7cba2beded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,7 +141,7 @@ export const validations: {
); );
}, },
isJson: function (values, value, minimum) { isJson: function (values, value, minimum) {
if (isExisty(value) && !isEmpty(value)) { if (isExisty(value) && !isEmpty(value) && typeof value === 'string') {
try { try {
JSON.parse(value); JSON.parse(value);
} catch (e) { } catch (e) {