-
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.
feat(SelectMenu): add
value-attribute
prop (#429)
Co-authored-by: Benjamin Canac <[email protected]>
- Loading branch information
1 parent
7cccbcf
commit 959c968
Showing
4 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
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
33 changes: 33 additions & 0 deletions
33
docs/components/content/examples/SelectMenuExampleObjectsValueAttribute.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,33 @@ | ||
<script setup> | ||
const people = [{ | ||
id: 1, | ||
name: 'Wade Cooper' | ||
}, { | ||
id: 2, | ||
name: 'Arlene Mccoy' | ||
}, { | ||
id: 3, | ||
name: 'Devon Webb' | ||
}, { | ||
id: 4, | ||
name: 'Tom Cook' | ||
}] | ||
const selected = ref(people[0].id) | ||
const current = computed(() => people.find(person => person.id === selected.value)) | ||
</script> | ||
|
||
<template> | ||
<USelectMenu | ||
v-model="selected" | ||
:options="people" | ||
placeholder="Select people" | ||
value-attribute="id" | ||
option-attribute="name" | ||
> | ||
<template #label> | ||
{{ current.name }} | ||
</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
959c968
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-nuxtlabs.vercel.app
ui-git-dev-nuxtlabs.vercel.app
ui.nuxtlabs.com