Fix number-input not returning numbers
This commit is contained in:
parent
249aa534c8
commit
3ca7bfeade
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SetCategoryAssignmentRequest struct {
|
type SetCategoryAssignmentRequest struct {
|
||||||
Assigned string
|
Assigned float64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) setCategoryAssignment(c *gin.Context) {
|
func (h *Handler) setCategoryAssignment(c *gin.Context) {
|
||||||
|
@ -1,17 +1,27 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue?: number | string
|
modelValue?: number | string,
|
||||||
|
type: string,
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emits = defineEmits<{
|
const emits = defineEmits<{
|
||||||
(e: "update:modelValue", value: number | string): void
|
(e: "update:modelValue", value: number | string): void
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
function valueChanged(e: Event) {
|
||||||
|
const target = <HTMLInputElement>e.target;
|
||||||
|
switch (props.type) {
|
||||||
|
case "number":
|
||||||
|
emits('update:modelValue', target.valueAsNumber);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log("STR-INPUT", props.type)
|
||||||
|
emits('update:modelValue', target.value)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<input
|
<input :value="modelValue" :type="type" class="dark:bg-slate-900" @input="valueChanged" />
|
||||||
:value="modelValue"
|
|
||||||
class="dark:bg-slate-900"
|
|
||||||
@input="emits('update:modelValue', ($event.target as HTMLInputElement)?.value)"
|
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
|
@ -61,7 +61,7 @@ export const useAccountStore = defineStore("budget/account", {
|
|||||||
return (category: Category): number => {
|
return (category: Category): number => {
|
||||||
return (
|
return (
|
||||||
category.AvailableLastMonth +
|
category.AvailableLastMonth +
|
||||||
Number(category.Assigned) +
|
category.Assigned +
|
||||||
category.Activity
|
category.Activity
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user