【发布时间】:2018-12-19 03:12:33
【问题描述】:
我有这个数组
this.complementaryFields = [
{
fieldName: 'complementaryLaser',
label: 'Laser Hair Removal'
},
{
fieldName: 'complementarySkin',
label: 'Skin'
},
{
fieldName: 'complementaryInjection',
label: 'Cosmetic Injections'
},
{
fieldName: 'complementaryNotSure',
label: 'Not Sure'
}
];
我想用它创建一个新数组,如下所示:
this.complementaryFieldNames = [
'complementaryLaser',
'complementarySkin',
'complementaryInjection',
'complementaryNotSure'
];
你会如何使用 lodash?
【问题讨论】:
-
没有 lodash :
complementaryFieldNames = complementaryFields.map({fieldName} => fieldName)