From 820b9898095509c0ea2b82ac7f786f1cf11a12bb Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Wed, 28 Jul 2021 19:08:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=BA=E6=89=8B=E6=94=B9=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh-CN/components/form/formitem.md | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/zh-CN/components/form/formitem.md b/docs/zh-CN/components/form/formitem.md index d010e2773..dde4966fb 100755 --- a/docs/zh-CN/components/form/formitem.md +++ b/docs/zh-CN/components/form/formitem.md @@ -610,6 +610,39 @@ amis 会有默认的报错信息,如果你想自定义校验信息,配置`va } ``` +默认的校验信息如下,可以直接配置文字,也可用多语言中的 key。参考:https://github.com/baidu/amis/blob/master/src/locale/zh-CN.ts#L175-L201 + +```js +{ + isEmail: 'validate.isEmail', + isRequired: 'validate.isRequired', + isUrl: 'validate.isUrl', + isInt: 'validate.isInt', + isAlpha: 'validate.isAlpha', + isNumeric: 'validate.isNumeric', + isAlphanumeric: 'validate.isAlphanumeric', + isFloat: 'validate.isFloat', + isWords: 'validate.isWords', + isUrlPath: 'validate.isUrlPath', + matchRegexp: 'validate.matchRegexp', + minLength: 'validate.minLength', + maxLength: 'validate.maxLength', + maximum: 'validate.maximum', + lt: 'validate.lt', + minimum: 'validate.minimum', + gt: 'validate.gt', + isJson: 'validate.isJson', + isLength: 'validate.isLength', + notEmptyString: 'validate.notEmptyString', + equalsField: 'validate.equalsField', + equals: 'validate.equals', + isPhoneNumber: 'validate.isPhoneNumber', + isTelNumber: 'validate.isTelNumber', + isZipcode: 'validate.isZipcode', + isId: 'validate.isId' +} +``` + ### 表单项值发生变化即校验 默认校验是当进行行为操作时,对表单项进行校验,如果你想每次表单项的值发生变化的时候就校验,请配置`"validateOnChange": true`