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