mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:18:03 +08:00
fix:validations.maxLength校验数据为数字 (#1880)
Co-authored-by: dqc <qianchuan.deng@gmail.com>
This commit is contained in:
parent
52223c914a
commit
9840a7add8
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user