1.第一种方法
ccc() {
let data = [
{ Uvwmap: 286 },
{ symmetry: 15 },
{ Shell: 286 },
{ Shell1: 286 },
{ Shell2: 286 },
];
let list = {};
for (let c in data) {
let key = Object.keys(data[c])[0];
list[key] = data[c][key];
}
console.log(list);
},
2.第二种方法 通过三点运算和Object.assign 对象合并
let data = [
{ Uvwmap: 286 },
{ symmetry: 15 },
{ Shell: 286 },
{ Shell1: 286 },
{ Shell2: 286 },
];
console.log(Object.assign(...data));