typeahead搜索框的自动提示

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

$('#search-query').typeahead({
            minLength: 1,
            order: "asc",
            group: [true, "{{group}}"],
            hint: true,
            dynamic: true,
            delay: 500,
            source: {
                "产品": {
                    display: ["proName", "proCode"],
                    href: "/product_/product?condition={{proCode}}",
                    url: [{type: "GET", url: "/widget/product", data: {search: "{{query}}"}}],
                    template: '<span class="row"><span>{{proName}}({{proCode}})</span></span>'
                },
                "项目": {
                    display: ["projectName", "projectCode"],
                    url: [{type: "GET", url: "/widget/project", data: {search: "{{query}}"}}],
                    template: '<span class="row"><span>{{projectName}}({{projectCode}})</span></span>'
                },
                "股票": {
                    display: ["sname", "id"],
                    url: [{type: "GET", url: "/widget/stocks", data: {stockinput: "{{query}}"}}],
                    template: '<span class="row"><span>{{sname}}({{id}})</span></span>'
                },
                "客户": {
                    display: ["custName", "pinyin"],
                    href: function (obj) {
                        return "/custom/customer?name=" + obj.custName
                    },
                    url: [{type: "GET", url: "/widget/customers", data: {custName: "{{query}}"}}],
                    template: '<span class="row"><span>{{custName}}({{pinyin}})</span></span>'
                }
            },
            callback: {
                onClick: function (node, a, obj, e) {
                    window.open(obj.href);
                }
            }
            ,
            debug: true
        })