其他分享
首页 > 其他分享> > vue Ehcarts There is a chart instance already initialized on the dom.

vue Ehcarts There is a chart instance already initialized on the dom.

作者:互联网

使用Echarts插件的时候,多次加载会出现There is a chart instance already initialized on the dom.这个错误,改插件已经加载完成。

解决方法:

在data()定义全局变量

data(){
return{
myChart=null
}
}

在使用插件方法中最前面添加

if (this.myChart != null && this.myChart!= "" && this.myChart!= undefined) {
this.myChart.dispose();
}

然后在实例化

this.myChart = echarts.init(document.getElementById('sjtjt'));

标签:插件,already,dom,There,myChart,instance,vue,initialized
来源: https://www.cnblogs.com/GentleKBP/p/10363903.html