feat: useForm ts type

pull/4361/head
tangjinzhou 2021-07-12 10:00:10 +08:00
parent cf60f9c46f
commit 39c866eb02
3 changed files with 4 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import { useInjectSize } from '../_util/hooks/useSize';
import useConfigInject from '../_util/hooks/useConfigInject';
import { useProvideForm } from './context';
import type { SizeType } from '../config-provider';
import useForm from './useForm';
export type RequiredMark = boolean | 'optional';
export type FormLayout = 'horizontal' | 'inline' | 'vertical';
@ -97,6 +98,7 @@ const Form = defineComponent({
colon: true,
}),
Item: FormItem,
useForm,
emits: ['finishFailed', 'submit', 'finish'],
setup(props, { emit, slots, expose, attrs }) {
const size = useInjectSize(props);
@ -371,4 +373,5 @@ const Form = defineComponent({
export default Form as typeof Form & {
readonly Item: typeof FormItem;
readonly useForm: typeof useForm;
};

View File

@ -15,7 +15,6 @@ Form.install = function (app: App) {
export { FormItem, formItemProps, formProps, useForm };
Form.useForm = useForm;
export default Form as typeof Form &
Plugin & {
readonly Item: typeof Form.Item;

2
v2-doc

@ -1 +1 @@
Subproject commit 128334b46af72232ea0dcc31540128ae53ae747d
Subproject commit d2c096476ee3e8d27fbb9e1cb7933887501b1fab