<el-autocomplete
v-model="form.user.email"
:fetch-suggestions="querySearchEmail"
:trigger-on-focus="false"
placeholder="接收邮件邮箱"
>
</el-autocomplete>
querySearchEmail(queryString, callback) {
const emailList = [
{ value: '@qq.com' },
{ value: '@126.com' },
{ value: '@163.com' },
{ value: '@sina.com' },
{ value: '@21cn.com' },
{ value: '@sohu.com' },
{ value: '@yahoo.com.cn' },
{ value: '@tom.com' },
{ value: '@etang.com' },
{ value: '@eyou.com' },
{ value: '@56.com' },
{ value: '@x.cn' },
{ value: '@chinaren.comsogou.com' },
{ value: '@citiz.com' },
]
let results = []
let queryList = []
emailList.map(item => {
queryList.push({ value: queryString.split('@')[0] + item.value })
})
results = queryString ? queryList.filter(this.createFilter(queryString)) : queryList;
callback(results);
},
createFilter(queryString) {
return (item) => {
return (item.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
};
},