This commit is contained in:
2020-06-30 22:21:34 +00:00
parent a5320d0e27
commit 6de37822aa
3 changed files with 28 additions and 8 deletions

View File

@@ -34,7 +34,6 @@ export default {
vm.appBar.icon = ctx.icon;
vm.appBar.title = ctx.title;
document.title = "AyaNova " + vm.$ay.t(ctx.title);
//Parse the formdata if present

View File

@@ -2,7 +2,6 @@
<div>
<v-text-field
ref="textField"
:value="formattedValue"
@input="handleInput"
v-currency="{
currency: currencyName,
@@ -20,21 +19,23 @@
</template>
<script>
/* Xeslint-disable */
//https://dm4t2.github.io/vue-currency-input/guide/#introduction
//https://dm4t2.github.io/vue-currency-input/guide/#introduction :value="formattedValue"
//https://codesandbox.io/s/vue-template-kd7d1?fontsize=14&module=%2Fsrc%2FApp.vue
//https://github.com/dm4t2/vue-currency-input
import { setValue, parseCurrency } from "vue-currency-input";
export default {
data() {
return {
formattedValue: this.value,
internalValue: null,
currencyName: window.$gz.locale.getCurrencyName(),
languageName: window.$gz.locale.getBrowserFirstLanguage()
languageName: window.$gz.locale.getBrowserFirstLanguage(),
internalChange: false
};
},
watch: {
value(value) {
setValue(this.$refs.textField.$refs.input, value);
value(val) {
this.internalChange = true;
setValue(this.$refs.textField.$refs.input, val);
}
},
props: {
@@ -54,8 +55,26 @@ export default {
currency: this.currencyName,
locale: this.languageName
});
if (this.internalChange) {
this.internalValue = ret;
this.internalChange = false;
return;
}
console.log(
`handleInput, comparing value of ${value} to internalValue of ${this.internalValue}`
);
if (ret == 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.formattedValue = value;
this.internalValue = ret;
}
}
};

View File

@@ -1,6 +1,7 @@
<template>
<v-container fluid>
<gz-report-selector ref="reportSelector"></gz-report-selector>
{{ formState }}
<v-row v-if="formState.ready">
<v-col>
<v-form ref="form">
@@ -409,6 +410,7 @@ export default {
!this.formState.loading &&
!this.formState.readOnly
) {
console.log("Calling fieldValueChanged for ", ref);
window.$gz.form.fieldValueChanged(this, ref);
}
},