[英]I am currently trying to return some data from an array displaying menu items into my search bar
I am currently trying to create a search bar to make it easy on my users so that they can type in the first letter of any ingredient such as "A" and it returns every ingredient item that is associated with that item. 我目前正在尝试创建一个搜索栏,以使用户轻松使用,以便他们可以输入任何成分(例如“ A”)的首字母,并返回与该项目关联的每个成分项目。 Such as "Avocado"
例如“鳄梨”
So far I have only created the array of ingredients . 到目前为止,我只创建了一系列的成分。 I am kind of new to coding so I am not sure how to get this filter list started.
我是编码的新手,所以不确定如何启动此过滤器列表。
Here's a brief explanation of my ingredient array 这是我的成分数组的简要说明
const ingredients: any = `{
"ingredients" : [
{
"ingredient" : "Avocado",
"category" : "Prepped"
"servings" : 35
},
{
"ingredient" : "Chopped Bacon",
"category" : "No Prep",
"servings" : 40,
}
]
] ]
My expected results are for the user to type in "a" into the search bar and ingredients from the menu will pop up such as... "Avocados", "Arugula", "Apples" etc. Please keep in mind my menu is collapsible. 我的预期结果是用户在搜索栏中输入“ a”,菜单上的配料会弹出,例如...“鳄梨”,“芝麻菜”,“苹果”等。请记住,我的菜单是可折叠。 So how will this work?
那么这将如何工作?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.