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'));


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM