diff --git a/src/components/ma-form/formItem/form-input-number.vue b/src/components/ma-form/formItem/form-input-number.vue index ddcfe9f3..f83491c8 100644 --- a/src/components/ma-form/formItem/form-input-number.vue +++ b/src/components/ma-form/formItem/form-input-number.vue @@ -66,10 +66,14 @@ const props = defineProps({ const formModel = inject('formModel') const getColumnService= inject('getColumnService') const columns = inject('columns') -const rv = async (ev, value = undefined) => await runEvent(props.component, ev, { formModel, getColumnService, columns }, value) const index = props.customField ?? props.component.dataIndex const value = ref(toNumber(get(formModel.value, index))) +const rv = async (ev, value = undefined) => { + if(ev === 'onChange') set(formModel.value, index, value) + await runEvent(props.component, ev, { formModel, getColumnService, columns }, value) +} + watch( () => get(formModel.value, index), vl => value.value = toNumber(vl)) watch( () => value.value, v => { if (isNaN(v)) v = undefined @@ -79,4 +83,4 @@ watch( () => value.value, v => { rv('onCreated') onMounted(() => rv('onMounted')) - \ No newline at end of file +