feat: useForm ts type
parent
cf60f9c46f
commit
39c866eb02
|
@ -27,6 +27,7 @@ import { useInjectSize } from '../_util/hooks/useSize';
|
||||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||||
import { useProvideForm } from './context';
|
import { useProvideForm } from './context';
|
||||||
import type { SizeType } from '../config-provider';
|
import type { SizeType } from '../config-provider';
|
||||||
|
import useForm from './useForm';
|
||||||
|
|
||||||
export type RequiredMark = boolean | 'optional';
|
export type RequiredMark = boolean | 'optional';
|
||||||
export type FormLayout = 'horizontal' | 'inline' | 'vertical';
|
export type FormLayout = 'horizontal' | 'inline' | 'vertical';
|
||||||
|
@ -97,6 +98,7 @@ const Form = defineComponent({
|
||||||
colon: true,
|
colon: true,
|
||||||
}),
|
}),
|
||||||
Item: FormItem,
|
Item: FormItem,
|
||||||
|
useForm,
|
||||||
emits: ['finishFailed', 'submit', 'finish'],
|
emits: ['finishFailed', 'submit', 'finish'],
|
||||||
setup(props, { emit, slots, expose, attrs }) {
|
setup(props, { emit, slots, expose, attrs }) {
|
||||||
const size = useInjectSize(props);
|
const size = useInjectSize(props);
|
||||||
|
@ -371,4 +373,5 @@ const Form = defineComponent({
|
||||||
|
|
||||||
export default Form as typeof Form & {
|
export default Form as typeof Form & {
|
||||||
readonly Item: typeof FormItem;
|
readonly Item: typeof FormItem;
|
||||||
|
readonly useForm: typeof useForm;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,6 @@ Form.install = function (app: App) {
|
||||||
|
|
||||||
export { FormItem, formItemProps, formProps, useForm };
|
export { FormItem, formItemProps, formProps, useForm };
|
||||||
|
|
||||||
Form.useForm = useForm;
|
|
||||||
export default Form as typeof Form &
|
export default Form as typeof Form &
|
||||||
Plugin & {
|
Plugin & {
|
||||||
readonly Item: typeof Form.Item;
|
readonly Item: typeof Form.Item;
|
||||||
|
|
2
v2-doc
2
v2-doc
|
@ -1 +1 @@
|
||||||
Subproject commit 128334b46af72232ea0dcc31540128ae53ae747d
|
Subproject commit d2c096476ee3e8d27fbb9e1cb7933887501b1fab
|
Loading…
Reference in New Issue