From 39c866eb029448208c99fa0937fe13d20e91ac8c Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 12 Jul 2021 10:00:10 +0800 Subject: [PATCH] feat: useForm ts type --- components/form/Form.tsx | 3 +++ components/form/index.tsx | 1 - v2-doc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 350fdc654..4e982fa25 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -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; }; diff --git a/components/form/index.tsx b/components/form/index.tsx index 66b6d8c86..cfb6c6135 100644 --- a/components/form/index.tsx +++ b/components/form/index.tsx @@ -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; diff --git a/v2-doc b/v2-doc index 128334b46..d2c096476 160000 --- a/v2-doc +++ b/v2-doc @@ -1 +1 @@ -Subproject commit 128334b46af72232ea0dcc31540128ae53ae747d +Subproject commit d2c096476ee3e8d27fbb9e1cb7933887501b1fab