Select2的使用方式
作者:互联网
$("#user").select2({
language: "zh-CN",
ajax: {
url: "/wms/hr/staff/findStaffByName",
dataType: "json",
type:'post',
delay: 250,
data: function (params) {
return {
word: params.term, // word是指传入后台的参数
size:50 //size也是传入后台,表示查到的限制条数为50
};
},
processResults: function (data, params) {
console.log(data)
return {
results: data.data,
};
},
cache: true,
},
minimumInputLength: 1,
templateResult: function (repo) {
return repo.name;
},
templateSelection: function (repo) {
return repo.name;
},
});
标签:function,return,方式,repo,params,使用,data,Select2,size 来源: https://blog.csdn.net/mrhe_/article/details/118734612