You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/auto-complete/demo/basic.md

717 B

#### 基本使用 基本使用。通过 dataSource 设置自动完成的数据源 #### Basic Usage Basic Usage, set datasource of autocomplete with `dataSource` property.
<template>
  <a-auto-complete
    :dataSource="dataSource"
    style="width: 200px"
    @select="onSelect"
    @search="handleSearch"
    placeholder="input here"
  />
</template>
<script>
export default {
  data() {
    return {
      dataSource: [],
    }
  },
  methods: {
    handleSearch(value) {
      this.dataSource = !value ? [] : [
        value,
        value + value,
        value + value + value,
      ]
    },
    onSelect(value) {
      console.log('onSelect', value);
    }
  }
}
</script>