From 1db8dc658816cca032c1cb70bcd3ebf07ecc7d8e Mon Sep 17 00:00:00 2001 From: baiyaaaaa Date: Tue, 20 Dec 2016 14:17:53 +0800 Subject: [PATCH] Revert "fix form validate callback params" (#1864) This reverts commit 87b13bf0e07c0ce8ac183ecd2020088c26a81de0. --- examples/docs/en-US/form.md | 8 ++++---- examples/docs/zh-CN/form.md | 10 +++++----- packages/form/src/form-item.vue | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/docs/en-US/form.md b/examples/docs/en-US/form.md index 09fbc02e9..834cf7193 100644 --- a/examples/docs/en-US/form.md +++ b/examples/docs/en-US/form.md @@ -809,10 +809,10 @@ Form component allows you to verify your data, helping you find and correct erro ### Form Methods -| Method | Description | params -| ---- | ---- | ---- -| validate | the method to validate the whole form | Function(callback: Function(boolean)) -| validateField | the method to validate a certain form item | Function(prop: string, callback: Function(errorMessage: string)) +| Method | Description | +| ---- | ---- | +| validate(cb) | the method to validate the whole form | +| validateField(prop, cb) | the method to validate a certain form item | | resetFields | reset all the fields and remove validation result | ### Form-Item Attributes diff --git a/examples/docs/zh-CN/form.md b/examples/docs/zh-CN/form.md index 0362e935e..152c0157e 100644 --- a/examples/docs/zh-CN/form.md +++ b/examples/docs/zh-CN/form.md @@ -799,11 +799,11 @@ ### Form Methods -| 方法名 | 说明 | 参数 -|---------- |-------------- | -------------- -| validate | 对整个表单进行校验的方法 | Function(callback: Function(boolean)) -| validateField | 对部分表单字段进行校验的方法 | Function(prop: string, callback: Function(errorMessage: string)) -| resetFields | 对整个表单进行重置,将所有字段值重置为空并移除校验结果 | - +| 方法名 | 说明 | +|---------- |-------------- | +| validate(cb) | 对整个表单进行校验的方法 | +| validateField(prop, cb) | 对部分表单字段进行校验的方法 | +| resetFields | 对整个表单进行重置,将所有字段值重置为空并移除校验结果 | ### Form-Item Attributes diff --git a/packages/form/src/form-item.vue b/packages/form/src/form-item.vue index fce6af5ed..5944dc19b 100644 --- a/packages/form/src/form-item.vue +++ b/packages/form/src/form-item.vue @@ -139,7 +139,7 @@ this.validateState = !errors ? 'success' : 'error'; this.validateMessage = errors ? errors[0].message : ''; - callback(this.validateMessage); + callback(errors); }); }, resetField() {