Tariff UI: fix decimal price input (#27950)
Some checks failed
Some checks failed
This commit is contained in:
parent
f24dcd5e11
commit
456f0d6062
1 changed files with 17 additions and 1 deletions
|
|
@ -83,7 +83,7 @@
|
|||
<div class="position-relative flex-grow-1">
|
||||
<input
|
||||
:id="id"
|
||||
v-model="value"
|
||||
:value="value"
|
||||
:list="datalistId"
|
||||
:type="inputType"
|
||||
:step="step"
|
||||
|
|
@ -98,6 +98,8 @@
|
|||
"
|
||||
:autocomplete="masked || datalistId ? 'off' : null"
|
||||
:disabled="disabled"
|
||||
@change="onFieldChange"
|
||||
@input="onFieldInput"
|
||||
/>
|
||||
<button
|
||||
v-if="showClearButton"
|
||||
|
|
@ -346,6 +348,20 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
coerceValue(val) {
|
||||
if (this.inputType === "number") {
|
||||
return val === "" ? "" : Number(val);
|
||||
}
|
||||
return val;
|
||||
},
|
||||
onFieldChange(e) {
|
||||
this.value = this.coerceValue(e.target.value);
|
||||
},
|
||||
onFieldInput(e) {
|
||||
if (!this.useLazyBinding) {
|
||||
this.value = this.coerceValue(e.target.value);
|
||||
}
|
||||
},
|
||||
getOptionName(value) {
|
||||
const translationKey = `config.options.${this.property}.${value || "none"}`;
|
||||
return this.$te(translationKey) ? this.$t(translationKey) : value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue