This commit is contained in:
2020-06-30 22:26:35 +00:00
parent 6de37822aa
commit 2fe2a87716
2 changed files with 29 additions and 25 deletions

View File

@@ -27,9 +27,9 @@ export default {
data() {
return {
internalValue: null,
internalChange: false,
currencyName: window.$gz.locale.getCurrencyName(),
languageName: window.$gz.locale.getBrowserFirstLanguage(),
internalChange: false
languageName: window.$gz.locale.getBrowserFirstLanguage()
};
},
watch: {
@@ -51,30 +51,23 @@ export default {
},
methods: {
handleInput(value) {
let ret = parseCurrency(value, {
let parsedValue = parseCurrency(value, {
currency: this.currencyName,
locale: this.languageName
});
if (this.internalChange) {
this.internalValue = ret;
this.internalValue = parsedValue;
this.internalChange = false;
return;
}
console.log(
`handleInput, comparing value of ${value} to internalValue of ${this.internalValue}`
);
if (ret == this.internalValue) {
if (parsedValue == this.internalValue) {
//nothing changed
return;
}
// let ret = parseCurrency(value, {
// currency: this.currencyName,
// locale: this.languageName
// });
console.log("currency-control emitting INPUT on value", ret);
this.$emit("input", ret);
this.internalValue = ret;
this.$emit("input", parsedValue);
this.internalValue = parsedValue;
}
}
};