remoteMethod(query) {
if (query !== '') {
var me = this;
this.loading = true;
this.$client.GetExamListByKeyword({keyword:query}).then(ret=>{
var total = ret.data.Total
me.loading = false;
var list=[];
for(var attr in ret.data.Exams){
list.push({label:ret.data.Exams[attr],value:attr});
}
me.ExamNameList=list;
});
} else {
this.ExamNameList = [];
}
},
判断取到的total,如果total大于50就显示提醒:只能展示五十条数据,请再精确,如果小于50条,直接输出ExamNameList
remoteMethod(query) {
if (query !== '') {
var me = this;
this.loading = true;
this.$client.GetExamListByKeyword({keyword:query}).then(ret=>{
let total = ret.data.Total
me.loading = false;
let list=[];
for(var attr in ret.data.Exams){
list.push({label:ret.data.Exams[attr],value:attr});
}
if (total > 50) {
// 提示操作
list.forEach((item,index) => {
if (index < 50) {
me.ExamNameList.push(item)
}else {
return;
}
})
}else {
me.ExamNameList=list;
}
});
} else {
this.ExamNameList = [];
}
},