fixed currency input bug

pull/44/head
A1Gard 6 months ago
parent 740aca9349
commit dec15afcc3

@ -73,6 +73,7 @@ export default {
}, },
mounted() { mounted() {
if (this.modelValue !== 'nop') { if (this.modelValue !== 'nop') {
if (typeof this.modelValue == 'number') { if (typeof this.modelValue == 'number') {
@ -94,9 +95,9 @@ export default {
computed: { computed: {
noComma: function () { noComma: function () {
const n = uncommafy(this.val); const n = uncommafy(this.val);
if (this.modelValue != null) { // if (this.modelValue != 'nop') {
this.$emit('update:modelValue', n); // this.$emit('update:modelValue', n);
} // }
return n; return n;
}, },
getClass: function () { getClass: function () {
@ -109,10 +110,18 @@ export default {
methods: { methods: {
keyup: function () { keyup: function () {
this.val = commafy(this.val); this.val = commafy(this.val);
this.$emit('update:modelValue', this.noComma);
if (typeof this.update === 'function') { if (typeof this.update === 'function') {
this.update(this.updateKey, parseInt(this.noComma)); this.update(this.updateKey, parseInt(this.noComma));
} }
}, },
},
watch: {
val(newValue) {
if (this.modelValue !== 'nop') {
this.$emit('update:modelValue', uncommafy(newValue));
}
}
} }
} }
</script> </script>

Loading…
Cancel
Save