mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: 修复 minLength 验证数字时异常的问题 (#5357)
This commit is contained in:
parent
7578fea6de
commit
3ba25f54ac
@ -12,7 +12,8 @@ fis.set('project.ignore', [
|
||||
'scripts/**',
|
||||
'npm/**',
|
||||
'gh-pages/**',
|
||||
'.*/**'
|
||||
'.*/**',
|
||||
'node_modules/**'
|
||||
]);
|
||||
// 配置只编译哪些文件。
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
"fis-optimizer-terser": "^1.0.1",
|
||||
"fis-parser-sass": "^1.2.0",
|
||||
"fis-parser-svgr": "^1.0.0",
|
||||
"fis3": "^3.4.41",
|
||||
"fis3": "^3.5.0-beta.2",
|
||||
"fis3-deploy-skip-packed": "0.0.5",
|
||||
"fis3-hook-commonjs": "^0.1.31",
|
||||
"fis3-hook-node_modules": "^2.3.1",
|
||||
|
@ -170,6 +170,11 @@ export const validations: {
|
||||
return validations.matchRegexp(values, value, /^[A-Z\s\u00C0-\u017F]+$/i);
|
||||
},
|
||||
isLength: function (values, value, length) {
|
||||
// 此方法应该判断文本长度,如果传入数据为number,导致 maxLength 和 maximum 表现一致了,默认转成string
|
||||
if (typeof value === 'number') {
|
||||
value = String(value);
|
||||
}
|
||||
|
||||
return !isExisty(value) || isEmpty(value) || value.length === length;
|
||||
},
|
||||
equals: function (values, value, eql) {
|
||||
@ -186,6 +191,10 @@ export const validations: {
|
||||
return !isExisty(value) || value.length <= length;
|
||||
},
|
||||
minLength: function (values, value, length) {
|
||||
// 此方法应该判断文本长度,如果传入数据为number,导致 maxLength 和 maximum 表现一致了,默认转成string
|
||||
if (typeof value === 'number') {
|
||||
value = String(value);
|
||||
}
|
||||
return !isExisty(value) || isEmpty(value) || value.length >= length;
|
||||
},
|
||||
isUrlPath: function (values, value, regexp) {
|
||||
|
Loading…
Reference in New Issue
Block a user