首页 > 其他 > 详细

使用echarts插件,多次加载出现There is a chart instance already initialized on the dom,报的警告,看不下去啦

时间:2021-07-15 11:46:26      阅读:17      评论:0      收藏:0      [点我收藏+]

解决方法:

在data()定义全局变量

data(){
  return{
    chart: null
  }
}

在使用插件方法中最前面添加

if (this.chart != null && this.chart != "" && this.chart != undefined) {
  this.chart.dispose();
}

然后在实例化

this.chart  = echarts.init(document.getElementById(‘#id‘));

使用echarts插件,多次加载出现There is a chart instance already initialized on the dom,报的警告,看不下去啦

原文:https://www.cnblogs.com/wpTing/p/15014287.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!