+
@@ -63,12 +78,12 @@ type Option = string | number | object
const props = withDefaults(
defineProps<{
- modelValue: Option[],
+ modelValue: Option[]
options: Option[]
disabled?: boolean
position?: string
- direction?: string,
- displayName?: (option: Option) => string,
+ direction?: string
+ displayName?: (option: Option) => string
search?: boolean
}>(),
{
@@ -80,9 +95,9 @@ const props = withDefaults(
},
)
-const emit = defineEmits(['update:modelValue', 'change']);
+const emit = defineEmits(['update:modelValue', 'change'])
const selectedValues = ref(props.modelValue || [])
-const searchInput = ref();
+const searchInput = ref()
const searchQuery = ref('')
@@ -98,7 +113,11 @@ const manyValues = computed({
})
const filteredOptions = computed(() => {
- return props.options.filter((x) => !searchQuery.value || props.displayName(x).toLowerCase().includes(searchQuery.value.toLowerCase()))
+ return props.options.filter(
+ (x) =>
+ !searchQuery.value ||
+ props.displayName(x).toLowerCase().includes(searchQuery.value.toLowerCase()),
+ )
})
defineOptions({
@@ -112,5 +131,4 @@ function toggleOption(id: Option) {
manyValues.value = [...manyValues.value, id]
}
}
-