Open JulBeg opened 1 week ago
@benjamincanac I see your comment in the related thread - does that mean this issue will be solved as part of it? I'm also not 100% if it's the same as the issue I'm currently experiencing, but it seems like it is. This is my (simplified) repro:
<template>
<USelectMenu
v-model="modelValue"
v-model:search-term="searchTerm"
value-key="iso"
:items="filteredCountries"
:filter="false"
>
<template
v-if="modelValue"
#default
>
{{ modelValue }}
</template>
<template #item="{ item }">
{{ item }}
</template>
</USelectMenu>
</template>
<script lang="ts" setup>
const modelValue = defineModel<string | undefined>();
const countries = [
{ name: 'denmark', iso: 'dk' },
{ name: 'sweden', iso: 'se' },
{ name: 'norway', iso: 'no' },
];
const searchTerm = ref('');
const filteredCountries = computed(() => {
if (!searchTerm.value) {
return countries;
}
const lowerCasedSearchTerm = searchTerm.value.toLowerCase();
return countries.filter(country =>
country.iso.toLowerCase().includes(lowerCasedSearchTerm)
|| country.name.toLowerCase().includes(lowerCasedSearchTerm),
);
});
</script>
Environment
Is this bug related to Nuxt or Vue?
Nuxt
Version
v3.0.0-alpha.9
Reproduction
https://ui3.nuxt.dev/components/input-menu#value-key
Description
In components
<USelectMenu />
and<UInputMenu />
filter is not working when using an array of object and the "value-key" propAdditional context
No response
Logs