1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| <script lang="ts" setup>
| import {
| Select,
| SelectContent,
| SelectItem,
| SelectTrigger,
| SelectValue,
| } from '../../ui';
|
| interface Props {
| class?: any;
| // 弹出层的类名
| contentClass?: any;
| options?: Array<{ label: string; value: string }>;
| placeholder?: string;
| }
|
| const props = defineProps<Props>();
| </script>
| <template>
| <Select>
| <SelectTrigger :class="props.class">
| <SelectValue :placeholder="placeholder" />
| </SelectTrigger>
| <SelectContent :class="props.contentClass">
| <template v-for="item in options" :key="item.value">
| <SelectItem :value="item.value"> {{ item.label }} </SelectItem>
| </template>
| </SelectContent>
| </Select>
| </template>
|
| <style lang="scss" scoped>
| button[role='combobox'][data-placeholder] {
| color: hsl(var(--muted-foreground));
| }
|
| button {
| --ring: var(--primary);
| }
| </style>
|
|