如何在我的 nextjs/typescript/fetch 应用程序中搜索这个数组?
我一直在尝试寻找方法来搜索这个数组(CustomersList),但没有走得太远。非常感谢您的帮助。
获取后(响应完成了什么):
const data = await res.json();
return {
props: {
CustomersList: data,
}
};
我如何将数据显示到页面:
<ul className="customers">
{CustomersList.map((customer) => (
<form method="POST" action={AppendUrl(customer.Id)}>
<table className="customer-list">
<tr>
<th>Customer Name:</th>
<th>Customer Id:</th>
</tr>
<tr>
<td>{customer.Name}</td>
<td>{customer.Id}</td>
<input type="submit" value="Select"/>
</tr>
</table>
</form>
))}
</ul>
我想向其中添加一个搜索栏,以便能够按客户的姓名(customer.Name)搜索这些客户
I've been trying to find ways to search through this array (CustomersList), but didn't get very far. Help would be much appreciated.
after the fetch(whats done with the response):
const data = await res.json();
return {
props: {
CustomersList: data,
}
};
How im displaying the data to the page:
<ul className="customers">
{CustomersList.map((customer) => (
<form method="POST" action={AppendUrl(customer.Id)}>
<table className="customer-list">
<tr>
<th>Customer Name:</th>
<th>Customer Id:</th>
</tr>
<tr>
<td>{customer.Name}</td>
<td>{customer.Id}</td>
<input type="submit" value="Select"/>
</tr>
</table>
</form>
))}
</ul>
I would like to add a searchbar to this to be able to search through these customers by their name (customer.Name)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际上发现了一些非常有用的代码。
搜索码:
搜索框输入码:
I actually found some code that was super helpful.
search code:
searchbox input code: