diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 1246eedcd..93cf332a3 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -27,6 +27,10 @@ const $props = defineProps({ type: Boolean, default: true, }, + emptyToNull: { + type: Boolean, + default: true, + }, }); const { validations } = useValidator(); @@ -39,6 +43,7 @@ const value = computed({ return $props.modelValue; }, set(value) { + if ($props.emptyToNull && value === '') value = null; emit('update:modelValue', value); }, });