解决方法:
在data()定义全局变量
data(){
return{
chart: null
}
}
在使用插件方法中最前面添加
if (this.chart != null && this.chart != "" && this.chart != undefined) {
this.chart.dispose();
}
然后在实例化
this.chart = echarts.init(document.getElementById('#id'));
data(){
return{
chart: null
}
}
if (this.chart != null && this.chart != "" && this.chart != undefined) {
this.chart.dispose();
}
this.chart = echarts.init(document.getElementById('#id'));