Form: emits error message on validate event (#12860)

* Form: Emits error message on validate events

* Update form.md
pull/12886/head
Yamen Sharaf 2018-09-26 04:50:50 +02:00 committed by hetech
parent 99a1f4f376
commit 44a85b8e60
4 changed files with 6 additions and 6 deletions

View File

@ -858,7 +858,7 @@ All components in a Form inherit their `size` attribute from that Form. Similarl
### Form Events
| Event Name | Description | Parameters |
|----------- |------------ |----------- |
| validate | triggers after a form item is validated | prop name of the form item being validated, whether validation is passed |
| validate | triggers after a form item is validated | prop name of the form item being validated, whether validation is passed and the error message if not |
### Form-Item Attributes

View File

@ -871,9 +871,9 @@ Todos los componentes de un formulario heredan su atributo `size`. De manera sim
### Form Events
| Nombre | Descripción | Parametros |
| -------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| validate | se dispara después de validar un item del formulario | la propiedad (`prop name`) nombre del item del form que se esta validando, si la validacion paso o no. |
| Nombre | Descripción | Parametros |
| -------- | ---------------------------------------------------- | ------------------------------------------------------------ |
| validate | se dispara después de validar un item del formulario | la propiedad (`prop name`) nombre del item del form que se esta validando, si la validacion paso o no, mensaje de error si existe. |
### Form-Item Atributos

View File

@ -846,7 +846,7 @@ W3C 标准中有如下[规定](https://www.w3.org/MarkUp/html-spec/html-spec_8.h
### Form Events
| 事件名称 | 说明 | 回调参数 |
|--------- |-------- |---------- |
| validate | 任一表单项被校验后触发 | 被校验的表单项 prop 值,校验是否通过 |
| validate | 任一表单项被校验后触发 | 被校验的表单项 prop 值,校验是否通过,错误消息(如果存在) |
### Form-Item Attributes

View File

@ -199,7 +199,7 @@
this.validateMessage = errors ? errors[0].message : '';
callback(this.validateMessage, invalidFields);
this.elForm && this.elForm.$emit('validate', this.prop, !errors);
this.elForm && this.elForm.$emit('validate', this.prop, !errors, this.validateMessage || null);
});
},
clearValidate() {