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