This commit is contained in:
@@ -19,6 +19,9 @@
|
||||
</template>
|
||||
<script>
|
||||
/* Xeslint-disable */
|
||||
//https://dm4t2.github.io/vue-currency-input/guide/#introduction
|
||||
//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() {
|
||||
|
||||
68
ayanova/src/components/decimal-control.vue
Normal file
68
ayanova/src/components/decimal-control.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-text-field
|
||||
ref="textField"
|
||||
:value="formattedValue"
|
||||
@input="handleInput"
|
||||
v-currency="{
|
||||
currency: null,
|
||||
locale: languageName
|
||||
}"
|
||||
:readonly="readonly"
|
||||
:label="label"
|
||||
:rules="rules"
|
||||
></v-text-field>
|
||||
<p v-show="error" class="form__error v-messages theme--light error--text">
|
||||
{{ error }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
/* Xeslint-disable */
|
||||
//https://dm4t2.github.io/vue-currency-input/guide/#introduction
|
||||
//https://codesandbox.io/s/vue-template-kd7d1?fontsize=14&module=%2Fsrc%2FApp.vue
|
||||
//https://github.com/dm4t2/vue-currency-input
|
||||
//NON CURRENCY MODE: https://dm4t2.github.io/vue-currency-input/config/#component
|
||||
import { setValue, parseCurrency } from "vue-currency-input";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formattedValue: this.value,
|
||||
languageName: window.$gz.locale.getBrowserFirstLanguage()
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
setValue(this.$refs.textField.$refs.input, value);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
label: String,
|
||||
rules: Array,
|
||||
value: { type: Number, default: null },
|
||||
readonly: { type: Boolean, default: false },
|
||||
error: {
|
||||
type: String,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
lt(ltKey) {
|
||||
return window.$gz.locale.get(ltKey);
|
||||
},
|
||||
locale() {
|
||||
return window.$gz.locale;
|
||||
},
|
||||
handleInput(value) {
|
||||
this.$emit(
|
||||
"input",
|
||||
parseCurrency(value, {
|
||||
currency: null,
|
||||
locale: this.languageName
|
||||
})
|
||||
);
|
||||
this.formattedValue = value;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user