feat(Form): add submit method

This commit is contained in:
陈嘉涵 2020-02-13 15:43:11 +08:00
parent 7b200d0053
commit fbe3d20558
3 changed files with 6 additions and 0 deletions

View File

@ -420,6 +420,7 @@ Use [ref](https://vuejs.org/v2/api/#ref) to get Form instance and call instance
| Name | Description | Attribute | Return value |
|------|------|------|------|
| submit | Submit form | - | - |
| validate | Validate form | *name?: string* | *Promise* |
| resetValidation | Reset validation | *name?: string* | - |

View File

@ -452,6 +452,7 @@ export default {
| 方法名 | 说明 | 参数 | 返回值 |
|------|------|------|------|
| submit | 提交表单,与点击提交按钮的效果等价 | - | - |
| validate | 验证表单,支持传入`name`来验证单个表单项 | *name?: string* | *Promise* |
| resetValidation | 重置表单项的验证提示,支持传入`name`来重置单个表单项 | *name?: string* | - |

View File

@ -106,7 +106,11 @@ export default createComponent({
onSubmit(event) {
event.preventDefault();
this.submit();
},
// @exposed-api
submit() {
const values = this.getValues();
this.validate()