0
我有場景,我需要根據用戶輸入過濾數組。以下是我的json。在挖空過濾嵌套數組
[
{
"storename": "store 1",
"license": "12314",
"books": [
"abc",
"def",
"cdf"
]
},
{
"storename": "store 2",
"license": "12344",
"books": [
"dfd",
"eww"
]
},
{
"storename": "store 3",
"license": "12344",
"books": [
]
}
]
我想過濾嵌套的數組,STORENAME和許可的項目應始終被退回,但書籍陣列將根據用戶的輸入返回。
我嘗試過使用ko.utils.arrayFilter,但沒有運氣。例如,如果用戶搜索書abc輸出應該是。
[
{
"storename": "store 1",
"license": "12314",
"books": [
"abc"
]
},
{
"storename": "store 2",
"license": "12344",
"books": [
]
},
{
"storename": "store 3",
"license": "12344",
"books": [
]
}
]
請附上您的代碼,並告訴我們* *特別是與代碼的問題。就目前來看,這個帖子更像是一個待辦事項而不是問題。 – Jeroen