From 2599e501cb9ed5b454657a35d7ccb06ab379a3a7 Mon Sep 17 00:00:00 2001 From: Mamalizz Date: Sun, 2 Feb 2025 23:05:33 +0330 Subject: [PATCH] fixed select state --- frontend/components/global/Select.vue | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/frontend/components/global/Select.vue b/frontend/components/global/Select.vue index f66f7a3..0b62161 100644 --- a/frontend/components/global/Select.vue +++ b/frontend/components/global/Select.vue @@ -13,7 +13,9 @@ type Emit = { // props -defineProps(); +const props = defineProps(); + +const { modelValue } = toRefs(props); // emit @@ -21,16 +23,12 @@ const emit = defineEmits(); // state -const selectedValue = ref(); +const selectedValue = computed({ + get: () => modelValue.value, + set: (value: string) => emit("update:modelValue", value), +}); // watch - -watch( - () => selectedValue.value, - (newValue) => { - emit("update:modelValue", newValue); - } -);