🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] > [手册](https://bootstrap-autocomplete.readthedocs.io/en/latest/) ## 安装 ``` 经过测试,这个版本支持 v3 的boostcss <script src="https://raw.githubusercontent.com/xcash/bootstrap-autocomplete/v2.3.0/dist/latest/bootstrap-autocomplete.js"></script> npm install bootstrap-autocomplete ``` ## 场景 ## hello world js 用法 ``` <input class="form-control basicAutoComplete" type="text" autocomplete="off"> $('.basicAutoComplete').autoComplete({ resolverSettings: { url: 'testdata/test-list.json' } }); ``` 使用data ``` <input class="form-control basicAutoComplete" type="text" data-url="myurl" autocomplete="off"> $('.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]); } }); ```