jQuery Boostrap autocomplete
最后更新于:2022-04-02 03:13:49
[TOC]
> [手册](https://bootstrap-autocomplete.readthedocs.io/en/latest/)
## 安装
```
npm install bootstrap-autocomplete
```
## 场景
## hello world
js 用法
```
$('.basicAutoComplete').autoComplete({
resolverSettings: {
url: 'testdata/test-list.json'
}
});
```
使用data
```
$('.basicAutoComplete').autoComplete();
```
### 复杂设置
```
$('#send_id').autocomplete({
source:function(query,process){
var matchCount = this.options.items;
$.getJSON(url,{"key":query,"top":matchCount},function(respData){
return process(respData);
});
},
formatItem:function(item){
return item["user_name"];
},
setValue:function(item){
return {'data-value':item["user_name"],'real-value':item["user_id"] + sp_item + item["user_name"]};
},
select:function(dataVal,realVal){
var arr=realVal.split(sp_item);
selectUserSearch(arr[0],arr[1]);
}
});
```
';