changed combobox logic
This commit is contained in:
@@ -33,7 +33,7 @@ const emit = defineEmits(["update:modelValue"]);
|
||||
|
||||
// state
|
||||
|
||||
const value = ref<OptionChildren>();
|
||||
const value = ref<OptionChildren | Option>();
|
||||
|
||||
// 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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user