forked from verdnatura/salix-front
Merge pull request 'feat(VnInput): empty to null' (!898) from 6766-vnInput_emptyToNull into dev
Reviewed-on: verdnatura/salix-front#898 Reviewed-by: Jorge Penadés <jorgep@verdnatura.es>
This commit is contained in:
commit
473b0808e8
|
@ -27,6 +27,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
emptyToNull: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const { validations } = useValidator();
|
const { validations } = useValidator();
|
||||||
|
|
||||||
|
@ -39,6 +43,7 @@ const value = computed({
|
||||||
return $props.modelValue;
|
return $props.modelValue;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
|
if ($props.emptyToNull && value === '') value = null;
|
||||||
emit('update:modelValue', value);
|
emit('update:modelValue', value);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue