not allow to input non number to the amount input box in desktop version via mobile device

This commit is contained in:
MaysWind
2024-09-25 23:17:55 +08:00
parent 720a5f8897
commit a3ff181b6e
+19 -1
View File
@@ -137,7 +137,25 @@ export default {
} }
}, },
'currentValue': function (newValue) { 'currentValue': function (newValue) {
this.$emit('update:modelValue', this.$locale.parseAmount(this.userStore, newValue)); let finalValue = '';
if (newValue) {
const decimalSeparator = this.$locale.getCurrentDecimalSeparator(this.userStore);
for (let i = 0; i < newValue.length; i++) {
if (!('0' <= newValue[i] && newValue[i] <= '9') && newValue[i] !== '-' && newValue[i] !== decimalSeparator) {
break;
}
finalValue += newValue[i];
}
}
if (finalValue !== newValue) {
this.currentValue = finalValue;
} else {
this.$emit('update:modelValue', this.$locale.parseAmount(this.userStore, finalValue));
}
} }
}, },
methods: { methods: {