PASSAGGIO A VITE !
AGG. 1.1.23
This commit is contained in:
@@ -2,7 +2,7 @@ import { defineComponent, onMounted, PropType, ref, watch, computed } from 'vue'
|
||||
import { tools } from '@src/store/Modules/tools'
|
||||
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
export default defineComponent({
|
||||
@@ -19,11 +19,11 @@ export default defineComponent({
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
components: { },
|
||||
components: {},
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
|
||||
|
||||
const inputValue = ref(props.modelValue);
|
||||
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
@@ -33,7 +33,7 @@ export default defineComponent({
|
||||
const displayValue = computed(() => {
|
||||
return inputValue.value === '' ? '0' : inputValue.value;
|
||||
});
|
||||
|
||||
|
||||
const handleInput = (value: string | number) => {
|
||||
if (value === '⌫') {
|
||||
inputValue.value = inputValue.value.slice(0, -1);
|
||||
@@ -42,11 +42,11 @@ export default defineComponent({
|
||||
} else if (typeof value === 'number') {
|
||||
inputValue.value += value.toString();
|
||||
}
|
||||
|
||||
|
||||
// Verifica se inputValue contiene più di due cifre decimali
|
||||
const decimalPattern = /^\d+(\.\d{0,2})?$/; // Regex per validare il numero
|
||||
const newValue = inputValue.value;
|
||||
|
||||
|
||||
// Se non rispetta il formato, tronca il numero a 2 cifre decimali
|
||||
if (!decimalPattern.test(newValue)) {
|
||||
// Se troviamo un punto decimale, manteniamo solo le prime 2 cifre
|
||||
@@ -59,10 +59,10 @@ export default defineComponent({
|
||||
inputValue.value = parts[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
emit('update:modelValue', inputValue.value);
|
||||
};
|
||||
|
||||
|
||||
function created() {
|
||||
// created
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user