解决echarts报There is a chart instance already initialized on the dom.错误

当echarts实例存在时,从柱状图切换到饼图或其他一些图时,会出错。
所以要先销毁这个实例
然后再重新创建

 echarts.init(document.getElementById("echartsTest5")).dispose();//解决echarts dom已经加载的报错
 myChart = echarts.init(document.getElementById("echartsTest5"));

直接使用mycharts.dispose()无效

posted @ 2021-05-07 18:04  嘿!那个姑娘  阅读(3604)  评论(0编辑  收藏  举报