Update auto-complete.vue

This commit is contained in:
Aresn 2019-01-07 14:29:32 +08:00 committed by GitHub
parent 5f25fecafb
commit 9d767f2084
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,41 +1,40 @@
<template> <template>
<div style="margin: 100px;width: 200px;"> <div style="margin: 100px;width: 200px;">
<auto-complete v-model="value" :data="data" :disabled="disabled"></auto-complete> <AutoComplete placement="top" 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> </div>
</template> </template>
<script> <script>
export default {
data() { export default {
props: {
},
data () {
return { return {
value: "", value: '',
disabled: false, data: [],
data: [] // data: ['Burns Bay Road', 'Downing Street', 'Wall Street']
}; };
}, },
methods: {}, computed: {},
created() { methods: {
setTimeout(() => { handleSearch (value) {
this.value = "1.0.0.5"; this.data = !value ? [] : [
this.data = [ value + '@qq.com',
"12412515", value + '@sina.com',
"123444", value + '@163.com'
"12355", ]
"12345", },
"12312", hc (v) {
"1234", // console.log(v)
"123", },
"111", fm (value, item) {
"5.2.3.4", return item.toUpperCase().indexOf(value.toUpperCase()) !== -1;
"1.2.3.4",
"1.2.3.4.5",
"1.2.3.4.5.6",
"1.2.3.4.5.6.7",
"1.0.0.8",
"1.0.0.5",
"whb-03"
];
// this.disabled = true;
}, 1000);
} }
}; }
};
</script> </script>