是否有任何选项或CSS技巧可以显示内联类型头建议(如SO标签建议中所示)?
我尝试了一些css(显示flex,改变宽度),但没有像我预期的那样工作。
这是当前的结果,
我需要像这样做
谢谢
答案 0 :(得分:1)
这可以通过简单的CSS来完成。建议包含在tt-menu > tt-dataset
div中。您可以更改宽度并设置tt-dataset
div的display:flex
.tt-menu{
width: 500 !important;
}
.tt-dataset{
display:flex;
}
答案 1 :(得分:0)
您可以使用模板呈现打印头的数据内容,这是我使用过的示例代码。
$('.typeahead').typeahead({
hint: true,
highlight: true,
minLength: 3
}, {
name: 'Cities',
source: citiesSubstringMatcher(),
display: 'name',
limit: 20,
templates: {
suggestion: suggestions_city_html
}
});
function suggestions_city_html(data) {
return "<div class='pointer'>" + data.name + "</div>";
}
你可以为此定义自己的模板。