mirror of
https://gitee.com/dromara/go-view.git
synced 2025-06-30 00:29:16 +08:00
feat: 修复组件刷新错误
This commit is contained in:
parent
ee54a366f0
commit
c60b2c2b8f
@ -40,7 +40,6 @@ export const useChartCommonData = (
|
||||
if(targetComponent.option){
|
||||
let seriesItem = cloneDeep(targetComponent.option.series[0])
|
||||
let series = []
|
||||
targetComponent.option.series.splice(0)
|
||||
if(dataset.dimensions.length - 1) {
|
||||
for(let i = 0; i < dataset.dimensions.length - 1; i++) {
|
||||
series.push(cloneDeep(seriesItem))
|
||||
@ -50,7 +49,7 @@ export const useChartCommonData = (
|
||||
series = [seriesItem]
|
||||
}
|
||||
if (vChartRef.value) {
|
||||
setOption(vChartRef.value, { series, dataset })
|
||||
setOption(vChartRef.value, { series, dataset: dataset })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -92,6 +91,7 @@ export const useChartCommonData = (
|
||||
if (res && res.errcode === ResultErrcode.SUCCESS) {
|
||||
try {
|
||||
const { data } = res
|
||||
console.log(data)
|
||||
if(Object.prototype.toString.call(data) === '[object Array]') {
|
||||
if(data.length) echartsUpdateHandle(data[0])
|
||||
}
|
||||
|
@ -44,5 +44,7 @@ export const setOption = <T extends typeof VChart | undefined, D>(instance: T, d
|
||||
if (!instance) return
|
||||
const option = instance.getOption()
|
||||
option.dataset = null
|
||||
instance.setOption(data)
|
||||
instance.setOption(data, {
|
||||
replaceMerge: ['series'],
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user