将大对象赋值到小对象

// 将传过来的数据赋值到本地对象
const a = {
    
     x: 1, y: 2, z: 3 }
const b = {
    
     x: '', y: '' }

// 获取所有的键值,根据键值判断是否赋值
const akeyList = Object.keys(a)
	for (var i in akeyList) {
    
    
	  if (_.has(b, akeyList[i])) {
    
     b[akeyList[i]] = a[akeyList[i]] }
}

Guess you like

Origin blog.csdn.net/weixin_40639095/article/details/120343935