55 lines
1.2 KiB
Vue
55 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
import {
|
|
Avatar,
|
|
AvatarImage,
|
|
AvatarFallback,
|
|
Description,
|
|
Label,
|
|
ListBox,
|
|
ListBoxItem,
|
|
ListBoxItemIndicator,
|
|
Surface,
|
|
} from "@heroui-vue/components";
|
|
const users = [
|
|
{
|
|
id: "1",
|
|
name: "Bob",
|
|
email: "bob@heroui.com",
|
|
src: "https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg",
|
|
},
|
|
{
|
|
id: "2",
|
|
name: "Fred",
|
|
email: "fred@heroui.com",
|
|
src: "https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg",
|
|
},
|
|
{
|
|
id: "3",
|
|
name: "Martha",
|
|
email: "martha@heroui.com",
|
|
src: "https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg",
|
|
},
|
|
];
|
|
</script>
|
|
<template>
|
|
<ListBox
|
|
:items="users"
|
|
v-slot="{ item: user }"
|
|
aria-label="用户"
|
|
selection-mode="single"
|
|
class="w-[220px]"
|
|
>
|
|
<ListBoxItem :id="user.id" :text-value="user.name">
|
|
<Avatar size="sm">
|
|
<AvatarImage :alt="user.name" :src="user.src" />
|
|
<AvatarFallback>{{ user.name[0] }}</AvatarFallback>
|
|
</Avatar>
|
|
<div class="flex flex-col">
|
|
<Label>{{ user.name }}</Label>
|
|
<Description>{{ user.email }}</Description>
|
|
</div>
|
|
<ListBoxItemIndicator />
|
|
</ListBoxItem>
|
|
</ListBox>
|
|
</template>
|