types(Form): add type definition

This commit is contained in:
陈嘉涵 2020-02-13 20:36:18 +08:00
parent 27187a2fc4
commit d80bbf64dd
3 changed files with 13 additions and 0 deletions

View File

@ -443,6 +443,8 @@ export default {
| error-message-align | 错误提示文案对齐方式,可选值为 `center` `right` | *string* | `left` | | error-message-align | 错误提示文案对齐方式,可选值为 `center` `right` | *string* | `left` |
| validate-first | 是否在某一项校验不通过时停止校验 | *boolean* | `false` | | validate-first | 是否在某一项校验不通过时停止校验 | *boolean* | `false` |
> 表单项的 API 参见:[Field 组件](#/zh-CN/field#api)
### Events ### Events
| 事件名 | 说明 | 回调参数 | | 事件名 | 说明 | 回调参数 |

9
types/form.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
import { VanComponent } from './component';
export class Form extends VanComponent {
submit(): void;
validate(name?: string): Promise<void>;
resetValidation(name?: string): void;
}

2
types/index.d.ts vendored
View File

@ -11,6 +11,7 @@ import { DatetimePicker } from './datetime-picker';
import { Dialog } from './dialog'; import { Dialog } from './dialog';
import { DropdownItem } from './dropdown-item'; import { DropdownItem } from './dropdown-item';
import { Field } from './field'; import { Field } from './field';
import { Form } from './form';
import { ImagePreview } from './image-preview'; import { ImagePreview } from './image-preview';
import { Lazyload } from './lazyload'; import { Lazyload } from './lazyload';
import { List } from './list'; import { List } from './list';
@ -98,6 +99,7 @@ export {
DatetimePicker, DatetimePicker,
Dialog, Dialog,
DropdownItem, DropdownItem,
Form,
Field, Field,
ImagePreview, ImagePreview,
Lazyload, Lazyload,