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

posted @ 2019-02-12 09:21  失去时间  阅读(2365)  评论(0编辑  收藏  举报