Browse Source

fix: form-item class not work

pull/4188/head
tanjinzhou 4 years ago
parent
commit
617e534fda
  1. 44
      components/form/FormItem.tsx
  2. 2
      v2-doc

44
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 }) {
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);
@ -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"
>
@ -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)]);
// },
});

2
v2-doc

@ -1 +1 @@
Subproject commit 0f6d531d088d5283250c8cec1c7e8be0e0d36a36
Subproject commit 6819090fbcc94b248bc761d5f26162f29c04b2ef
Loading…
Cancel
Save