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

48 lines
860 B
Markdown
Raw Normal View History

2018-02-28 11:07:04 +00:00
<cn>
#### 自定义输入组件
自定义输入组件。
</cn>
<us>
#### Customize Input Component
Customize Input Component
</us>
```html
<template>
<a-auto-complete
:dataSource="dataSource"
style="width: 200px"
@search="handleSearch"
@select="onSelect"
>
<a-textarea
placeholder="input here"
class="custom"
style="height: 50px"
2018-03-01 04:34:31 +00:00
@keypress="handleKeyPress"
2018-02-28 11:07:04 +00:00
/>
</a-auto-complete>
</template>
<script>
2019-09-28 12:45:07 +00:00
export default {
data() {
return {
dataSource: [],
};
2018-02-28 11:07:04 +00:00
},
2019-09-28 12:45:07 +00:00
methods: {
onSelect(value) {
console.log('onSelect', value);
},
handleSearch(value) {
this.dataSource = !value ? [] : [value, value + value, value + value + value];
},
handleKeyPress(ev) {
console.log('handleKeyPress', ev);
},
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>
```