feat:修复自定义组件设置主题后导入到大屏中主题切换失效的问题

main
liu.shiyi 2 years ago
parent 978d32020c
commit ccd49bd345

@ -319,7 +319,9 @@ export default {
group: randomStr, group: randomStr,
code: randomStr + chart.code code: randomStr + chart.code
} }
this.$refs.Render.addChart(newChart, { x: chart.x, y: chart.y }, true) // theme
const isComponent = true
this.$refs.Render.addChart(newChart, { x: chart.x, y: chart.y }, isComponent)
this.updateRightVisiable(false) this.updateRightVisiable(false)
}) })
}) })

@ -306,7 +306,7 @@ export default {
this.hLine = hLine this.hLine = hLine
}, },
// //
addChart (chart, position) { addChart (chart, position, isComponent) {
const { left, top } = this.$el.getBoundingClientRect() const { left, top } = this.$el.getBoundingClientRect()
const _chart = !chart.code ? JSON.parse(chart) : chart const _chart = !chart.code ? JSON.parse(chart) : chart
let option = _chart.option let option = _chart.option
@ -330,12 +330,11 @@ export default {
option option
} }
config.key = config.code config.key = config.code
// TODO: // 1theme 2
// g2 if (!isComponent) {
// if (['customComponent'].includes(_chart.type)) { config.theme = settingToTheme(config, 'dark')
config.theme = settingToTheme(config, 'dark') config.theme = settingToTheme(config, 'light')
config.theme = settingToTheme(config, 'light') }
// }
this.addItem(config) this.addItem(config)
}, },
addSourceChart (chart, position) { addSourceChart (chart, position) {

Loading…
Cancel
Save