-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(SelectMenu): fixes non-strings and nested searchable attributes (#…
…967) Co-authored-by: Benjamin Canac <[email protected]>
- Loading branch information
1 parent
73d0fa7
commit 37fdf22
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
docs/components/content/examples/SelectMenuExampleSearchAttributes.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<script setup> | ||
const options = [ | ||
{ id: 1, name: 'Wade Cooper', favoriteColors: ['red', 'yellow'] }, | ||
{ id: 2, name: 'Arlene Mccoy', favoriteColors: ['blue', 'yellow'] }, | ||
{ id: 3, name: 'Devon Webb', favoriteColors: ['green', 'blue'] }, | ||
{ id: 4, name: 'Tom Cook', favoriteColors: ['blue', 'red'] }, | ||
{ id: 5, name: 'Tanya Fox', favoriteColors: ['green', 'red'] }, | ||
{ id: 5, name: 'Hellen Schmidt', favoriteColors: ['green', 'yellow'] } | ||
] | ||
const selected = ref(options[1]) | ||
</script> | ||
|
||
<template> | ||
<USelectMenu | ||
v-model="selected" | ||
:options="options" | ||
class="w-full lg:w-96" | ||
placeholder="Select an user" | ||
searchable | ||
searchable-placeholder="Search by name or favorite colors" | ||
option-attribute="name" | ||
by="id" | ||
:search-attributes="['name', 'favoriteColors']" | ||
> | ||
<template #option="{ option: person }"> | ||
<span v-for="color in person.favoriteColors" :key="color.id" class="h-2 w-2 rounded-full" :class="`bg-${color}-500 dark:bg-${color}-400`" /> | ||
<span class="truncate">{{ person.name }}</span> | ||
</template> | ||
</USelectMenu> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37fdf22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ui – ./
ui-git-dev-nuxt-js.vercel.app
ui-nuxt-js.vercel.app
ui.nuxt.com