xieb
2023-09-13 3667807a7b7418efc090ee3fa6a6b734bc3080bf
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
<template>
    <div>
        <a-select v-bind="$attrs" ref="select" v-model:value="value" :options="options" @change="handleChange">
          <template #suffixIcon><CaretDownOutlined class="ant-select-suffix" /></template>
        </a-select>
    </div>
</template>
 
<script setup lang="ts">
import { computed, defineProps, defineEmits } from 'vue'
import { CaretDownOutlined } from '@ant-design/icons-vue'
const emit = defineEmits(['update:modelValue', 'handleChange'])
type Option = {
    label: string,
    value: any
}
const props = defineProps({
  options: {
    type: Object as () => Option[],
    required: true,
  },
  modelValue: [String, Number],
})
const value = computed({
  get: () => props.modelValue,
  set: (val) => emit('update:modelValue', val),
})
const handleChange = (e: any) => {
  emit('handleChange', e)
}
</script>