Skip to content

Commit

Permalink
fix: form-item class not work
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Jun 9, 2021
1 parent 6cff37b commit 617e534
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 42 deletions.
44 changes: 3 additions & 41 deletions 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 }) {
setup(props, { slots, attrs }) {
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 @@ -336,9 +336,11 @@ export default defineComponent({
}
return (
<Row
{...attrs}
class={[
itemClassName.value,
domErrorVisible.value || !!help ? `${prefixCls.value}-item-with-help` : '',
attrs.class,
]}
key="row"
>
Expand Down Expand Up @@ -370,44 +372,4 @@ export default defineComponent({
);
};
},
// data() {
// warning(!hasProp(this, 'prop'), `\`prop\` is deprecated. Please use \`name\` instead.`);
// return {
// validateState: this.validateStatus,
// validateMessage: '',
// validateDisabled: false,
// validator: {},
// helpShow: false,
// errors: [],
// initialValue: undefined,
// };
// },
// render() {
// const { autoLink } = getOptionProps(this);
// const children = getSlot(this);
// let firstChildren = children[0];
// if (this.fieldName && autoLink && isValidElement(firstChildren)) {
// const originalEvents = getEvents(firstChildren);
// const originalBlur = originalEvents.onBlur;
// const originalChange = originalEvents.onChange;
// firstChildren = cloneElement(firstChildren, {
// ...(this.fieldId ? { id: this.fieldId } : undefined),
// onBlur: (...args: any[]) => {
// originalBlur && originalBlur(...args);
// this.onFieldBlur();
// },
// onChange: (...args: any[]) => {
// if (Array.isArray(originalChange)) {
// for (let i = 0, l = originalChange.length; i < l; i++) {
// originalChange[i](...args);
// }
// } else if (originalChange) {
// originalChange(...args);
// }
// this.onFieldChange();
// },
// });
// }
// return this.renderFormItem([firstChildren, children.slice(1)]);
// },
});

0 comments on commit 617e534

Please sign in to comment.