mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
34 lines
556 B
Vue
34 lines
556 B
Vue
<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>
|