Ant—Design下拉选择器自带搜索功能

<a-form-model-item label="赠品:" style="margin-top:20px">
  <a-select placeholder='请选择赠品' :filterOption="filterOption" show-search @change="filterGift">
    <a-select-option v-for="(item,index) in giveawayList" :key="index" :value="item.id">
      {{item.name}}
    </a-select-option>
  </a-select>
</a-form-model-item>
filterOption (input, option) {
  return (
    option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  )
}

主要是 filterOption 和 show-search 来实现搜索,如下图所示:

上一篇:搭建JMeter+Jenkins+Ant持续化


下一篇:字节回应“抄袭阿里Ant Design代码”深表歉意,Semi Design项目开源