我想按类别获取 Main 的数组
[
{
"@id": "/api/main/7648",
"@type": "Main",
category: [{
name: "laboriosam"
}]
},
{
"@id": "/api/main/7647",
"@type": "Main",
category: [{
name: "foo"
},
{
name: "bar"
}
]
}
]
所以我尝试:
console.log([...this.state.mains].filter(main => main.category.filter(category => category.name == "foo")))
但它返回了我的一切,我不明白为什么?
慕少森
九州编程
相关分类