fix:validations.maxLength校验数据为数字 (#1880)

Co-authored-by: dqc <qianchuan.deng@gmail.com>
This commit is contained in:
qianchuan 2021-04-25 17:40:48 +08:00 committed by GitHub
parent 52223c914a
commit 9840a7add8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,6 +106,10 @@ export const validations: {
return value == values[field];
},
maxLength: function (values, value, length) {
// 此方法应该判断文本长度如果传入数据为number导致 maxLength 和 maximum 表现一致了默认转成string
if (typeof value === 'number') {
value = String(value);
}
return !isExisty(value) || value.length <= length;
},
minLength: function (values, value, length) {