//对象的合并
objectMerge(source,destination){
for(let key in destination){
if(source.hasOwnProperty(key)){
// 重复属性的解决方案
if(destination[key].constructor===Array){
source[key]=[{...source[key][0],...destination[key][0]}]
}
if(destination[key].constructor===Object){
source[key]={...source[key],...destination[key]};
}
}else{
// 新属性的解决方案
source[key]=destination[key];
}
}
return source;
}
封装echarts图表
最新推荐文章于 2024-07-05 11:10:29 发布