From d95d7fe708e4f513cda4ce609f9cff0a2266cd22 Mon Sep 17 00:00:00 2001 From: zhanghangt <100103431@qq.com> Date: Sat, 1 Jun 2024 15:51:18 +0800 Subject: [PATCH] Update form-input-number.vue --- src/components/ma-form/formItem/form-input-number.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 +