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.icon = ctx.icon;
vm.appBar.title = ctx.title; vm.appBar.title = ctx.title;
document.title = "AyaNova " + vm.$ay.t(ctx.title); document.title = "AyaNova " + vm.$ay.t(ctx.title);
//Parse the formdata if present //Parse the formdata if present

View File

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

View File

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