From 791ae38bf8f431dc3ff90f16a3cb64066c18905f Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Wed, 9 Jun 2021 11:33:08 +0800 Subject: [PATCH] fix: form-item expose some method #4183 --- components/form/FormItem.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index 4e78d2be5..4b526b9e7 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -108,7 +108,7 @@ export default defineComponent({ __ANT_NEW_FORM_ITEM: true, props: formItemProps, slots: ['help', 'label', 'extra'], - setup(props, { slots, attrs }) { + setup(props, { slots, attrs, expose }) { warning(props.prop === undefined, `\`prop\` is deprecated. Please use \`name\` instead.`); const eventKey = `form-item-${++indexGuid}`; const { prefixCls } = useConfigInject('form', props); @@ -272,6 +272,12 @@ export default defineComponent({ control.focus(); } }; + expose({ + onFieldBlur, + onFieldChange, + clearValidate, + resetField, + }); formContext.addField(eventKey, { fieldValue, fieldId,