obj1 = { "authList": [ ], "enabled": 1, "id": "b3bae8fcde0d4a50b7fbcbbccf4fe216", "lastLogin": 1564363725773, "lastLoginStr": "2019-07-29", "namePinyin": "chenghua", "namePinyinFirst": "c", "rowLocked": 0, "sex": 2, "userAccount": "chenghua", "userName": "lomo" }, obj2 ={ "sex": '', "userAccount": "", "userName": "" }
解决方法
Object.keys(obj2).forEach(key=>{obj2[key]=obj1[key]})