From 5373db57bda4662d683020a7dffaf311820431a3 Mon Sep 17 00:00:00 2001 From: Mamalizz Date: Wed, 4 Jun 2025 19:11:11 +0330 Subject: [PATCH] changed combobox logic --- frontend/components/global/ComboBox.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/components/global/ComboBox.vue b/frontend/components/global/ComboBox.vue index 19622a0..6c06e4a 100644 --- a/frontend/components/global/ComboBox.vue +++ b/frontend/components/global/ComboBox.vue @@ -33,7 +33,7 @@ const emit = defineEmits(["update:modelValue"]); // state -const value = ref(); +const value = ref(); // watch @@ -49,7 +49,10 @@ watch( watch( () => modelValue.value, (newValue) => { - const target = options.value.flatMap((option) => option.children).find((child) => child.id == newValue); + let target; + target = newValue?.toString().startsWith("category") + ? options.value.find((child) => child.slug == newValue) + : options.value.flatMap((option) => option.children).find((child) => child.slug == newValue); value.value = target || undefined; },