Skip to content

Commit 617e534

Browse files
committed
fix: form-item class not work
1 parent 6cff37b commit 617e534

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

components/form/FormItem.tsx

+3-41
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default defineComponent({
108108
__ANT_NEW_FORM_ITEM: true,
109109
props: formItemProps,
110110
slots: ['help', 'label', 'extra'],
111-
setup(props, { slots }) {
111+
setup(props, { slots, attrs }) {
112112
warning(props.prop === undefined, `\`prop\` is deprecated. Please use \`name\` instead.`);
113113
const eventKey = `form-item-${++indexGuid}`;
114114
const { prefixCls } = useConfigInject('form', props);
@@ -336,9 +336,11 @@ export default defineComponent({
336336
}
337337
return (
338338
<Row
339+
{...attrs}
339340
class={[
340341
itemClassName.value,
341342
domErrorVisible.value || !!help ? `${prefixCls.value}-item-with-help` : '',
343+
attrs.class,
342344
]}
343345
key="row"
344346
>
@@ -370,44 +372,4 @@ export default defineComponent({
370372
);
371373
};
372374
},
373-
// data() {
374-
// warning(!hasProp(this, 'prop'), `\`prop\` is deprecated. Please use \`name\` instead.`);
375-
// return {
376-
// validateState: this.validateStatus,
377-
// validateMessage: '',
378-
// validateDisabled: false,
379-
// validator: {},
380-
// helpShow: false,
381-
// errors: [],
382-
// initialValue: undefined,
383-
// };
384-
// },
385-
// render() {
386-
// const { autoLink } = getOptionProps(this);
387-
// const children = getSlot(this);
388-
// let firstChildren = children[0];
389-
// if (this.fieldName && autoLink && isValidElement(firstChildren)) {
390-
// const originalEvents = getEvents(firstChildren);
391-
// const originalBlur = originalEvents.onBlur;
392-
// const originalChange = originalEvents.onChange;
393-
// firstChildren = cloneElement(firstChildren, {
394-
// ...(this.fieldId ? { id: this.fieldId } : undefined),
395-
// onBlur: (...args: any[]) => {
396-
// originalBlur && originalBlur(...args);
397-
// this.onFieldBlur();
398-
// },
399-
// onChange: (...args: any[]) => {
400-
// if (Array.isArray(originalChange)) {
401-
// for (let i = 0, l = originalChange.length; i < l; i++) {
402-
// originalChange[i](...args);
403-
// }
404-
// } else if (originalChange) {
405-
// originalChange(...args);
406-
// }
407-
// this.onFieldChange();
408-
// },
409-
// });
410-
// }
411-
// return this.renderFormItem([firstChildren, children.slice(1)]);
412-
// },
413375
});

0 commit comments

Comments
 (0)