Skip to content

Commit

Permalink
fix(select-menu): fix options type
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaubree committed Aug 17, 2023
1 parent dddddcd commit 8d18cd2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/select/USelectMenu.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup lang="ts" generic="T extends { [key: string]: any; isDisabled?: boolean } | string">
<script setup lang="ts" generic="T extends { [key: string]: any; isDisabled?: boolean }">
import { Combobox, ComboboxButton, ComboboxInput, ComboboxOption, ComboboxOptions, Listbox, ListboxButton, ListboxOption, ListboxOptions } from '@headlessui/vue'
import { merge } from 'lodash-es'
import type { appConfig } from '~/config'
Expand Down Expand Up @@ -118,13 +118,13 @@ const trailingIconClass = computed(() => classNames(
const filteredOptions = computed(() => {
const opt = Array.isArray(modelValue.value) && props.isMultiple
? reduceOptions([...props.options, ...modelValue.value])
: props.options as any
: props.options
return query.value === ''
? opt
: opt.filter((option: any) => {
: opt.filter((option) => {
return (props.searchAttributes?.length ? props.searchAttributes : [props.optionAttribute]).some((searchAttribute: any) => {
return typeof option === 'string' ? option.search(new RegExp(query.value, 'i')) !== -1 : (option[searchAttribute] && option[searchAttribute].search(new RegExp(query.value, 'i')) !== -1)
return (option[searchAttribute] && option[searchAttribute].search(new RegExp(query.value, 'i')) !== -1)
})
})
})
Expand Down

0 comments on commit 8d18cd2

Please # to comment.