commonClass: {
name: "",
relation: "",
id_card: "",
sex: "",
birthday: "",
nation: "",
survey_province: "",
survey_city: "",
survey_county: "",
survey_place: "",
registr_province: "",
registr_city: "",
registr_county: "",
registr_place: "",
},
member_info=[
{
name:"小明",
sex:"男"
},
{
name:"小红",
relation:"女儿"
},
...
]
member_info.forEach((i, j) => {
Object.keys(that.commonClass).forEach((p, q) => {
if (!i.hasOwnProperty(p)) {
i[p] = that.commonPeopleClass[p]
}
})
})
判断数组对象内是否有该字段 有则跳过 无则添加
最新推荐文章于 2023-01-05 10:54:46 发布