Merge pull request 'feat(VnInput): empty to null' (!898) from 6766-vnInput_emptyToNull into dev
gitea/salix-front/pipeline/head This commit looks good Details
gitea/salix-front/pipeline/pr-dev This commit looks good Details

Reviewed-on: #898
Reviewed-by: Jorge Penadés <jorgep@verdnatura.es>
This commit is contained in:
Alex Moreno 2024-11-05 14:05:01 +00:00
commit 473b0808e8
1 changed files with 5 additions and 0 deletions

View File

@ -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);
},
});