ant-design-vue/components/auto-complete/demo/basic.md

39 lines
717 B
Markdown
Raw Normal View History

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