首页 > 其他分享 >echarts console warning

echarts console warning

时间:2023-01-07 13:46:44浏览次数:45  
标签:console option value pieChart warning const echarts echartsRef

1. 项目版本:"echarts": "^5.3.3", vue3;

2:出现问题:

 

 3:解决方案:

<div class="compose-pie">
    <div ref="echartsRef" class="main-chart"></div>
  </div>

...
const echartsRef = ref<HTMLElement>()
const pieChart = ref<echarts.EChartsType>()

if (echartsRef.value) {
      // 在有图表的时候先清除
      pieChart.value?.dispose()
      pieChart.value = markRaw(echarts.init(echartsRef.value as HTMLElement, '', { height: 400 }))
      const option = getOptions()
      // 使用 es6 解构语法生成新的 option
      pieChart.value.setOption({ ...option })
      window.addEventListener('resize', chartResize)
    }

 

标签:console,option,value,pieChart,warning,const,echarts,echartsRef
From: https://www.cnblogs.com/liweize/p/17032519.html

相关文章