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">
|
<div class="position-relative flex-grow-1">
|
||||||
<input
|
<input
|
||||||
:id="id"
|
:id="id"
|
||||||
v-model="value"
|
:value="value"
|
||||||
:list="datalistId"
|
:list="datalistId"
|
||||||
:type="inputType"
|
:type="inputType"
|
||||||
:step="step"
|
:step="step"
|
||||||
|
|
@ -98,6 +98,8 @@
|
||||||
"
|
"
|
||||||
:autocomplete="masked || datalistId ? 'off' : null"
|
:autocomplete="masked || datalistId ? 'off' : null"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
|
@change="onFieldChange"
|
||||||
|
@input="onFieldInput"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
v-if="showClearButton"
|
v-if="showClearButton"
|
||||||
|
|
@ -346,6 +348,20 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
getOptionName(value) {
|
||||||
const translationKey = `config.options.${this.property}.${value || "none"}`;
|
const translationKey = `config.options.${this.property}.${value || "none"}`;
|
||||||
return this.$te(translationKey) ? this.$t(translationKey) : value;
|
return this.$te(translationKey) ? this.$t(translationKey) : value;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue