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