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