Skip to content

Commit f1202ca

Browse files
committed
FaSelect 组件支持更多类型
1 parent 8daee24 commit f1202ca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/ui/components/FaSelect/index.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import type { AcceptableValue } from 'reka-ui'
23
import type { HTMLAttributes } from 'vue'
34
import { cn } from '@/utils'
45
import {
@@ -18,13 +19,13 @@ const props = defineProps<{
1819
disabled?: boolean
1920
options: {
2021
label: string
21-
value: string
22+
value: AcceptableValue
2223
disabled?: boolean
2324
}[]
2425
class?: HTMLAttributes['class']
2526
}>()
2627
27-
const value = defineModel<string>()
28+
const value = defineModel<AcceptableValue>()
2829
2930
const selectedOption = computed({
3031
get() {
@@ -43,7 +44,7 @@ const selectedOption = computed({
4344
</SelectTrigger>
4445
<SelectContent>
4546
<SelectGroup>
46-
<SelectItem v-for="option in options" :key="option.value" :value="option.value" :disabled="option.disabled">
47+
<SelectItem v-for="(option, index) in options" :key="index" :value="option.value" :disabled="option.disabled">
4748
{{ option.label }}
4849
</SelectItem>
4950
</SelectGroup>

0 commit comments

Comments
 (0)