@fiscozen/composables 0.1.20-beta.1 → 0.1.20-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,10 +4,10 @@ export const useCurrency = () => {
|
|
|
4
4
|
const inputRef: Ref<HTMLInputElement|null> = ref(null)
|
|
5
5
|
const vm = getCurrentInstance()
|
|
6
6
|
|
|
7
|
-
const computedModel = computed<number|undefined>(() => vm?.props.amount as unknown as number|undefined)
|
|
8
|
-
const internalVal = ref<number>()
|
|
7
|
+
const computedModel = computed<number|string|undefined>(() => vm?.props.amount as unknown as number|undefined)
|
|
8
|
+
const internalVal = ref<number|string>()
|
|
9
9
|
|
|
10
|
-
const format = (input: number) => {
|
|
10
|
+
const format = (input: number|string) => {
|
|
11
11
|
return input.toLocaleString('it-IT', {
|
|
12
12
|
minimumFractionDigits: 2,
|
|
13
13
|
maximumFractionDigits: 2,
|
|
@@ -26,7 +26,7 @@ export const useCurrency = () => {
|
|
|
26
26
|
}
|
|
27
27
|
if (vm) {
|
|
28
28
|
internalVal.value = val
|
|
29
|
-
vm.emit('update:amount', val)
|
|
29
|
+
vm.emit('update:amount', typeof computedModel.value === 'number' ? val : val.toString())
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -75,11 +75,6 @@ export const useCurrency = () => {
|
|
|
75
75
|
}
|
|
76
76
|
newVal.addEventListener('input', onInput(newVal))
|
|
77
77
|
newVal.addEventListener('blur', onBlur)
|
|
78
|
-
|
|
79
|
-
if (computedModel.value) {
|
|
80
|
-
newVal.value = format(computedModel.value)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
78
|
})
|
|
84
79
|
|
|
85
80
|
watch(computedModel, (newVal) => {
|