Better handling of empty state in numeric field.
This commit is contained in:
parent
cb5d643839
commit
59d5cd453a
|
@ -4,7 +4,7 @@
|
|||
:ref="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
|
||||
:disabled="disabled"
|
||||
:placeholder="itemMetadatum.metadatum.placeholder ? itemMetadatum.metadatum.placeholder : ''"
|
||||
:model-value="Number(value)"
|
||||
:model-value="value === 0 || value ? Number(value) : null"
|
||||
lang="en"
|
||||
:min="getMin"
|
||||
:max="getMax"
|
||||
|
@ -52,6 +52,12 @@
|
|||
if ( inputRef && !inputRef.checkHtml5Validity())
|
||||
return;
|
||||
|
||||
// Allowing empty value as a state different of 0
|
||||
if ( value === null || value === undefined || value === '' )
|
||||
value = '';
|
||||
else
|
||||
value = Number(value);
|
||||
|
||||
this.$emit('update:value', value);
|
||||
},
|
||||
onBlur() {
|
||||
|
|
Loading…
Reference in New Issue