fix: 优化G2组件的动态配置赋值,对于属性路径,将不存在的属性赋值空对象处理

main
hong.yang 1 year ago
parent e6cf38ba67
commit 7dfb749f2c

@ -147,7 +147,9 @@ export default {
let option = null let option = null
config.setting.forEach(set => { config.setting.forEach(set => {
if (set.optionField) { if (set.optionField) {
// point.style.fill
const optionField = set.optionField.split('.') const optionField = set.optionField.split('.')
// [point,style,fill]
option = config.option option = config.option
optionField.forEach((field, index) => { optionField.forEach((field, index) => {
if (index === optionField.length - 1) { if (index === optionField.length - 1) {
@ -156,6 +158,10 @@ export default {
option[field] = set.value option[field] = set.value
} }
} else { } else {
//
if (!option[field]) {
option[field] = {}
}
option = option[field] option = option[field]
} }
}) })

Loading…
Cancel
Save