السطحي : : http: //underscorejs.org/
: http: //www.css88.com/doc/underscore/
: :
@{viewbag.title = "index" ؛} <script src = "scripts/bootstrap-typeahead.js"> </script> <script src = "scripts/insercore-min.js"> </script> <viv>简单使用
<div style = "margin: 10px 50px"> <label for = "product_search"> البحث عن المنتج: </label> <input id = "product_search" type = "text" data-provide = "typeahead" data-source = '["" data1 "،" data2 "،
使用脚本填充数据
<div style = "margin: 10px 50px"> <label for = "product_search"> بحث المنتج: </label> <input id = "product_search_js" type = "text" data-provide = "typeAhead"> </vivn = function () {var that = this ؛ setTimeOut (function () {that.hide ()} ، 250) ؛} ؛ $ ('#product_search_js'). typeahead ({source: function (query ، process) {return ["JS 数据 1" ، "JS 数据 2" ، "JS 数据 3"] "<==" ؛} ، updater: function (item) {console.log ("" " + ite +" '"محدد.") ؛支持 Ajax 获取数据
<div style = "margin: 10px 50px"> <label for = "product_search"> البحث عن المنتج: </label> <input id = "product_search_ajax" type = "text" data-provide = "typeahead"> </sureeTr = {query: query} ؛ $. post ('@url.action ("ajaxservice")' ، المعلمة ، الدالة (البيانات) {process (data) ؛}) ؛}}) ؛ </script>使用对象数据
<div style = "margin: 10px 50px"> <label for = "product_search"> البحث عن المنتج: </label> <input id = "product_search_object" type = "text" data-provide = "typeahead"> </viv> <script type = "text/javaScript 499.98} ، {id: 1 ، الاسم: "Object2" ، السعر: 134.99} ، {id: 2 ، الاسم: "Object3" ، السعر: 49.95}] ؛ $ ('#product_search_object'). product.name ؛}) ؛ العملية (النتائج) ؛} ، highlighter: function (item) {return "==>" + item + "<==" ؛控制器
Action ActionResult INDEX () {return view () ؛} ActionResult AjaxService () {String Query = "" ؛ if (! string.isnullorWhiteSpace (request ["Query"])) Query = request ["Query"].: :
下面继续给大家介绍 bootstrap 学习系列之 bootstrap typeahead 组件实现百度下拉效果 (续)
以上所述是小编给大家介绍的 bootstrap 学习系列之使用 bootstrap typeahead 组件实现百度下拉效果 希望对大家有所帮助 , , 如果大家有任何疑问请给我留言 , 小编会及时回复大家的。在此也非常感谢大家对武林网网站的支持!