后台管理 bootstrap-select模糊搜索
如果你是用jq开发后台管理系统可以用bootstrap-select插件去进行模糊查询:
创建一个demo,引入CDN
<!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-select.min.css"> <!-- Latest compiled and minified JavaScript --> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap-select.min.js"></script> <!-- (Optional) Latest compiled and minified JavaScript translation files --> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/i18n/defaults-*.min.js"></script>
html中写入
<select class="selectpicker"> <option>Mustard</option> <option>Ketchup</option> <option>Barbecue</option> </select>
script中调用
Via JavaScript
// To style only selects with the my-select class $('.my-select').selectpicker();
or
// To style all selects $('select').selectpicker();
If calling bootstrap-select via JavaScript, you will need to wrap your code in a .ready()
block or place it at the bottom of the page (after the last instance of bootstrap-select).
$(function () { $('select').selectpicker(); });