当前位置:网站首页>Recursively check if a configuration item has changed and replace it
Recursively check if a configuration item has changed and replace it
2022-08-02 02:45:00 【Xianyu_JavaScript】
介绍
- When the configuration item has the original configuration item,I don't want to change other configurations and can change the proposed configuration.参考 echarts 的配置
- 本文以递归的方式,实现了对象format check and replace,Arrays can be added according to the rules;
- The values that support the same attribute are based on the incoming attribute value;Properties that are not in the original configuration are added directly(当前级);
- According to the third point can be supported echarts、Secondary packaging configuration such as maps.
实现代码
const configSet = (config, eCData = echartsComponent.data) => {
if (!config) return;
Object.keys(eCData).forEach(key => {
if (!(key in config)) return
if (Object.prototype.toString.call(config[key]) === '[object Object]') return configSet(config[key], eCData[key])
eCData[key] = config[key]
})
Object.keys(config).forEach(key => {
if (!(key in eCData)) eCData[key] = config[key]
})
}
边栏推荐
猜你喜欢
The state status is displayed incorrectly after the openGauss switch
详解最强分布式锁工具:Redisson
mockjs生成假数据的基本使用
AWR analysis report questions for help: How can SQL be optimized from what aspects?
字符串常用方法
Nanoprobes丨1-巯基-(三甘醇)甲醚功能化金纳米颗粒
GTK RGB图像绘制
Analysis of the status quo of digital transformation of manufacturing enterprises
[Server data recovery] Data recovery case of server Raid5 array mdisk disk offline
Chopper webshell feature analysis
随机推荐
Moonbeam and Project integration of the Galaxy, bring brand-new user experience for the community
NIO‘s Sword(牛客多校赛)
考完PMP学什么?前方软考等着你~
analog IC layout
feign调用不通问题,JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r
The failure to create a role in Dahua Westward Journey has been solved
Safety (2)
Unable to log in to the Westward Journey
cadence landscape bindkey
Nanoprobes纳米探针丨Nanogold偶联物的特点和应用
qt点云配准软件
周鸿祎称微软抄袭,窃取360安全模式
数仓:数仓从ETL到ELT架构的转化以及俩者的区别
ReentrantLock工作原理
Flask入门学习教程
欧拉公式的证明
2022 NPDP take an examination of how the results?How to query?
OperatingSystemMXBean获取系统性能指标
最大层内元素和
KICAD 小封装拉线卡顿问题 解决方法