auto-complete.vue
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
<div style="margin: 100px;width: 200px;">
<AutoComplete transfer v-model="value" icon="ios-search" :data="data" @on-search="handleSearch" @on-change="hc" :filter-method="fm">
<!--<Option v-for="item in data" :value="item" :label="item" :key="item">-->
<!--<span style="color: red">{{ item }}</span>-->
<!--</Option>-->
</AutoComplete>
</div>
</template>
<script>
export default {
props: {
},
data () {
return {
value: '',
data: [],
// data: ['Burns Bay Road', 'Downing Street', 'Wall Street']
};
},
computed: {},
methods: {
handleSearch (value) {
this.data = !value ? [] : [
value + '@qq.com',
value + '@sina.com',
value + '@163.com'
]
},
hc (v) {
// console.log(v)
},
fm (value, item) {
return item.toUpperCase().indexOf(value.toUpperCase()) !== -1;
}
}
};
</script>