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 来实现搜索,如下图所示:


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM