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.
|
|
|
|
|
|
|
<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"
|
|
|
|
@keydown="handleKeyPress"
|
|
|
|
/>
|
|
|
|
</a-auto-complete>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dataSource: [],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onSelect(value) {
|
|
|
|
console.log('onSelect', value);
|
|
|
|
},
|
|
|
|
handleSearch(value) {
|
|
|
|
this.dataSource = !value ? [] : [
|
|
|
|
value,
|
|
|
|
value + value,
|
|
|
|
value + value + value,
|
|
|
|
]
|
|
|
|
},
|
|
|
|
handleKeyPress(ev) {
|
|
|
|
console.log('handleKeyPress', ev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
```
|
|
|
|
|