58 lines
1.6 KiB
Vue
58 lines
1.6 KiB
Vue
<script setup lang="ts">
|
|
import {
|
|
Select,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
SelectIndicator,
|
|
SelectPopover,
|
|
ListBox,
|
|
ListBoxItem,
|
|
ListBoxItemIndicator,
|
|
Label,
|
|
Button,
|
|
} from "@heroui-vue/components";
|
|
import { ref } from "vue";
|
|
const open = ref(false);
|
|
</script>
|
|
<template>
|
|
<div class="space-y-4">
|
|
<Select v-model:open="open" class="w-[256px]" placeholder="请选择">
|
|
<Label>州</Label>
|
|
<SelectTrigger>
|
|
<SelectValue />
|
|
<SelectIndicator />
|
|
</SelectTrigger>
|
|
<SelectPopover>
|
|
<ListBox>
|
|
<ListBoxItem id="florida" text-value="佛罗里达">
|
|
佛罗里达
|
|
<ListBoxItemIndicator />
|
|
</ListBoxItem>
|
|
<ListBoxItem id="delaware" text-value="特拉华">
|
|
特拉华
|
|
<ListBoxItemIndicator />
|
|
</ListBoxItem>
|
|
<ListBoxItem id="california" text-value="加利福尼亚">
|
|
加利福尼亚
|
|
<ListBoxItemIndicator />
|
|
</ListBoxItem>
|
|
<ListBoxItem id="texas" text-value="德克萨斯">
|
|
德克萨斯
|
|
<ListBoxItemIndicator />
|
|
</ListBoxItem>
|
|
<ListBoxItem id="new-york" text-value="纽约">
|
|
纽约
|
|
<ListBoxItemIndicator />
|
|
</ListBoxItem>
|
|
<ListBoxItem id="washington" text-value="华盛顿">
|
|
华盛顿
|
|
<ListBoxItemIndicator />
|
|
</ListBoxItem>
|
|
</ListBox>
|
|
</SelectPopover>
|
|
</Select>
|
|
<Button @click="open = !open">{{ open ? "关闭" : "打开" }}选择框</Button>
|
|
<p class="text-sm text-muted">选择框{{ open ? "已打开" : "已关闭" }}</p>
|
|
</div>
|
|
</template>
|