调用时,要在页面dom渲染完毕后(可以通过this.$nextTick(()) => {}进行确认),再进行渲染echarts
// vue 函数中
let chartDom = document.getElementById("myChart2")
//将下面if判断加入
if (chartDom.hasAttribute("_echarts_instance_")) {
chartDom.removeAttribute("_echarts_instance_");
}
this.myChartLed = this.$echarts.init(chartDom);
let option = {
...
};
this.myChartLed.clear();
this.myChartLed.setOption(option);