【发布时间】:2019-07-03 07:20:38
【问题描述】:
我有这个“产品”数组(包含“产品”子文档,每个文档都有自己的唯一 ID):
Products: [
{ listPrice: '1.90', Product: {id: 'xxx1'} },
{ listPrice: '3.90', Product: {id: 'xxx2'} },
{ listPrice: '5.90', Product: {id: 'xxx3'} }
]
我想使用 Lodash 在下面得到这个结果:
filterIds = ['xxx1', 'xxx2', 'xxx3'];
在我的代码中,这是我写的:
filterIds = _.map(this.Products.Product, 'id');
但它只返回 [ ]。
【问题讨论】:
标签: lodash sub-array subdocument