guoshilong
2023-11-13 54849757852f6ab40eb17afbd03d1d839b60a38d
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
<template>
    <div>
        <a-input-search v-model:value="value" :placeholder="placeholder" @search="onSearch" />
    </div>
</template>
 
<script setup lang="ts">
import { computed, defineProps, defineEmits } from 'vue'
import { CaretDownOutlined } from '@ant-design/icons-vue'
const emit = defineEmits(['update:modelValue', 'search'])
type Option = {
    label: string,
    value: any
}
const props = defineProps({
  modelValue: [String, Number],
  placeholder: {
    type: String,
    default: '搜索'
  }
})
const value = computed({
  get: () => props.modelValue,
  set: (val) => emit('update:modelValue', val),
})
const onSearch = () => {
  emit('search')
}
</script>