vue3具体使用方法如下 :option-filter-prop=" 'label' ",value还是label根据实际情况。如根据姓名过滤,:label="" 要指定为option的label
<a-select v-model:value="formData.managerUserId"
:disabled=!managerUserEditFlag
:placeholder="$t('common.pleaseSelect') + $t('customer.managerUserId')"
@change="managerUserChange"
allow-clear
show-search
:option-filter-prop="'label'" >
<a-select-option v-for="(item,index) in manageOptions" key="index"
:value="item.id"
:label="item.name">
{{ item.name }}
</a-select-option>
</a-select>
其余部分简单介绍一下,详细了解可以到官方文档查看。
官方文档地址如下:Ant Design Vue — An enterprise-class UI components based on Ant Design and Vue.js
allow-clear:是否可以清除输入的内容
show-search:是否可以下拉检索
还可以把optionFilterProp 和 filterOption结合使用,类型指定为children,但children类型目前在一些版本中已经不支持了。
<template>
<a-select
show-search
placeholder="Select a person"
option-filter-prop="children"
style="width: 200px"
:filter-option="filterOption"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange"
>
<a-select-option value="jack">
Jack
</a-select-option>
<a-select-option value="lucy">
Lucy
</a-select-option>
<a-select-option value="tom">
Tom
</a-select-option>
</a-select>
</template>