我正在遍历对象列表,但是当调用异步函数时,我得到了带有数字的对象数组,现在我无法映射这些数组。
{
'0': {
id: '22be325d3564d713',
name: 'dasdasdas',
affiliateIds: 2,
platformIds: 2,
campaignIds: [],
deviceOses: [],
deviceTypes: [],
countryCodes: [],
entryType: 'RED',
model: 'REVENUE_RATIO',
value: 0.01,
active: 1,
createdAt: 2020-06-11T06:00:53.000Z,
updatedAt: 2020-06-11T06:00:53.000Z
},
'1': {
id: '2891e303645099fd',
name: '',
affiliateIds: [],
platformIds: [],
campaignIds: [],
deviceOses: [],
deviceTypes: [],
countryCodes: [],
entryType: 'CNV',
model: 'REVENUE_RATIO',
value: 0.7,
active: 1,
createdAt: 2018-01-09T11:12:29.000Z,
updatedAt: 2018-01-09T11:12:29.000Z
},
我正试着把身份证
Object.map(a => a.id);
但是因为这些号码我拿不到身份证
如果您对数字属性名称不感兴趣,可以使用object.values()
null
const res = Object.values(data).map(({id}) => id)
console.log(res)
<script>
const data={0:{id:"22be325d3564d713",name:"dasdasdas",affiliateIds:2,platformIds:2,campaignIds:[],deviceOses:[],deviceTypes:[],countryCodes:[],entryType:"RED",model:"REVENUE_RATIO",value:.01,active:1,createdAt:"2020 - 06 - 11 T06: 00: 53.000 Z",updatedAt:"2020 - 06 - 11 T06: 00: 53.000 Z"},1:{id:"2891e303645099fd",name:"",affiliateIds:[],platformIds:[],campaignIds:[],deviceOses:[],deviceTypes:[],countryCodes:[],entryType:"CNV",model:"REVENUE_RATIO",value:.7,active:1,createdAt:"2018 - 01 - 09 T11: 12: 29.000 Z",updatedAt:"2018 - 01 - 09 T11: 12: 29.000 Z"}};
</script>