Browse Source

fix(BasicForm->FormItem): model should update before event call (#3573). resolve #3570

pull/3575/head
xachary 3 years ago
committed by GitHub
parent
commit
43aa743032
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 16
      src/components/Form/src/components/FormItem.vue

16
src/components/Form/src/components/FormItem.vue

@ -280,12 +280,14 @@
const on = { const on = {
[eventKey]: (...args: Nullable<Recordable<any>>[]) => { [eventKey]: (...args: Nullable<Recordable<any>>[]) => {
const [e] = args; const [e] = args;
if (propsData[eventKey]) {
propsData[eventKey](...args);
}
const target = e ? e.target : null; const target = e ? e.target : null;
const value = target ? (isCheck ? target.checked : target.value) : e; const value = target ? (isCheck ? target.checked : target.value) : e;
props.setFormModel(field, value, props.schema); props.setFormModel(field, value, props.schema);
if (propsData[eventKey]) {
propsData[eventKey](...args);
}
}, },
}; };
const Comp = componentMap.get(component) as ReturnType<typeof defineComponent>; const Comp = componentMap.get(component) as ReturnType<typeof defineComponent>;
@ -385,8 +387,8 @@
return slot return slot
? getSlot(slots, slot, unref(getValues), opts) ? getSlot(slots, slot, unref(getValues), opts)
: render : render
? render(unref(getValues), opts) ? render(unref(getValues), opts)
: renderComponent(); : renderComponent();
}; };
const showSuffix = !!suffix; const showSuffix = !!suffix;
@ -437,8 +439,8 @@
return colSlot return colSlot
? getSlot(slots, colSlot, values, opts) ? getSlot(slots, colSlot, values, opts)
: renderColContent : renderColContent
? renderColContent(values, opts) ? renderColContent(values, opts)
: renderItem(); : renderItem();
}; };
return ( return (

Loading…
Cancel
Save