mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Form): add submit method
This commit is contained in:
parent
7b200d0053
commit
fbe3d20558
@ -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* | - |
|
||||
|
||||
|
@ -452,6 +452,7 @@ export default {
|
||||
|
||||
| 方法名 | 说明 | 参数 | 返回值 |
|
||||
|------|------|------|------|
|
||||
| submit | 提交表单,与点击提交按钮的效果等价 | - | - |
|
||||
| validate | 验证表单,支持传入`name`来验证单个表单项 | *name?: string* | *Promise* |
|
||||
| resetValidation | 重置表单项的验证提示,支持传入`name`来重置单个表单项 | *name?: string* | - |
|
||||
|
||||
|
@ -106,7 +106,11 @@ export default createComponent({
|
||||
|
||||
onSubmit(event) {
|
||||
event.preventDefault();
|
||||
this.submit();
|
||||
},
|
||||
|
||||
// @exposed-api
|
||||
submit() {
|
||||
const values = this.getValues();
|
||||
|
||||
this.validate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user