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

在data()定义全局变量
data(){
  return{
    chart: null
  }
}

在使用插件方法中最前面添加
if (this.chart != null && this.chart != "" && this.chart != undefined) {
  this.chart.dispose();
}

然后在实例化
this.chart  = echarts.init(document.getElementById('#id'));

在实际工作中,通过select下拉框,选择不同的echarts图,出现了统计图被覆盖的现象

以上为解决方法

posted @   雪莉06  阅读(214)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示