diff --git a/src/form/README.zh-CN.md b/src/form/README.zh-CN.md index fa96eafba..d291601be 100644 --- a/src/form/README.zh-CN.md +++ b/src/form/README.zh-CN.md @@ -443,6 +443,8 @@ export default { | error-message-align | 错误提示文案对齐方式,可选值为 `center` `right` | *string* | `left` | | validate-first | 是否在某一项校验不通过时停止校验 | *boolean* | `false` | +> 表单项的 API 参见:[Field 组件](#/zh-CN/field#api) + ### Events | 事件名 | 说明 | 回调参数 | diff --git a/types/form.d.ts b/types/form.d.ts new file mode 100644 index 000000000..4d5859ef7 --- /dev/null +++ b/types/form.d.ts @@ -0,0 +1,9 @@ +import { VanComponent } from './component'; + +export class Form extends VanComponent { + submit(): void; + + validate(name?: string): Promise; + + resetValidation(name?: string): void; +} diff --git a/types/index.d.ts b/types/index.d.ts index 3f1971218..96db95695 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -11,6 +11,7 @@ import { DatetimePicker } from './datetime-picker'; import { Dialog } from './dialog'; import { DropdownItem } from './dropdown-item'; import { Field } from './field'; +import { Form } from './form'; import { ImagePreview } from './image-preview'; import { Lazyload } from './lazyload'; import { List } from './list'; @@ -98,6 +99,7 @@ export { DatetimePicker, Dialog, DropdownItem, + Form, Field, ImagePreview, Lazyload,