我正在使用 ASP.NET Core MVC 构建电子商务 Web 应用。我的_layout 页面上有一个搜索栏。我想显示商品的详细信息,例如图像、标题和价格,这些值已经存储在数据库中。我附上了一张带有这个问题的图片。我想让我的搜索栏类似于此图片:
我的搜索条码如下:
<div class="olContent f1">
<form method="get" asp-controller="Home" asp-action="AllProducts">
<div class="olSearch fr">
<input type="text" name="search" placeholder="Enter Keyword" class="inputComn form-control"/>
<div class="searchIcon">
<button type="submit" class="searchBtn">
<img src="~/images/searchIcon.png"/>
</button>
</div>
</div>
</form>
</div>
最佳答案
您可以使用 twitter typeahead jsplugin。有了这个,您可以选择设计自己的模板(即您的搜索应该如何显示)。 通过以上链接中的自定义模板。
关于javascript - 如何在搜索栏中获取项目的详细信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68148822/