Skip to content

Commit

Permalink
fix: form-item expose some method #4183
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Jun 9, 2021
1 parent a2e5d96 commit 791ae38
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/form/FormItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -272,6 +272,12 @@ export default defineComponent({
control.focus();
}
};
expose({
onFieldBlur,
onFieldChange,
clearValidate,
resetField,
});
formContext.addField(eventKey, {
fieldValue,
fieldId,
Expand Down

0 comments on commit 791ae38

Please sign in to comment.