echarts console warning

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)
    }

 

posted @ 2023-01-07 13:33  李卫泽  阅读(50)  评论(0)    收藏  举报