mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-26 01:40:34 +01:00
fix(SelectCustom): handle search on string arrays
This commit is contained in:
@@ -292,11 +292,11 @@ const iconClass = computed(() => {
|
|||||||
const filteredOptions = computed(() =>
|
const filteredOptions = computed(() =>
|
||||||
query.value === ''
|
query.value === ''
|
||||||
? props.options
|
? props.options
|
||||||
: props.options.filter((option: any) => {
|
: (props.options as any[]).filter((option: any) => {
|
||||||
return (props.searchAttributes?.length ? props.searchAttributes : [props.textAttribute]).some((searchAttribute: any) => {
|
return (props.searchAttributes?.length ? props.searchAttributes : [props.textAttribute]).some((searchAttribute: any) => {
|
||||||
return option[searchAttribute] && option[searchAttribute].search(new RegExp(query.value, 'i')) !== -1
|
return typeof option === 'string' ? option.search(new RegExp(query.value, 'i')) !== -1 : (option[searchAttribute] && option[searchAttribute].search(new RegExp(query.value, 'i')) !== -1)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const queryOption = computed(() => {
|
const queryOption = computed(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user