From abd7b76636c53f69c5d4ff6e0cec87f037170fa8 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 5 Nov 2024 13:50:25 +0100 Subject: [PATCH] feat(VnInput): empty to null --- src/components/common/VnInput.vue | 5 +++++ 1 file changed, 5 insertions(+) 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); }, });