<template>
  <a-select
    v-model:value="selectValue"
    show-search
    placeholder="input search text"
    style="width: 200px"
    :default-active-first-option="false"
    :show-arrow="false"
    :filter-option="false"
    :not-found-content="null"
    :options="data"
    @search="handleSearch"
    @change="handleChange"
  >
  </a-select>
</template>
<script>
import { defineComponent } from 'vue';

export default defineComponent({
  setup() {
    let selectValue = '';
    let data = [
      {
        code:'1',
        value:'cgb',
      },
      {
        code:'2',
        value:'lcf',
      },
    ];
    const handleSearch = val => {
      console.log('handleSearch val',val);
    };

    const handleChange = (val,option) =>{
      console.log('handleChange val',val);
      console.log('handleChange option',option);//option为选中行的所有数据,如:{code: "1", value: "cgb"}
    };

    return {
      handleSearch,
      handleChange,
      data,
      selectValue,
    };
  },
});
</script>

Logo

前往低代码交流专区

更多推荐