zoukankan      html  css  js  c++  java
  • echarts 报错 should not be called during main process

    原因是,在循环渲染多个图表的时候,渲染的图表和数据有先后顺序,有时候出现对应不上的情况,可能是数据已经好了,图表要渲染慢一些

    导致这个问题

    解决就是,放在定时器中,比如,我这个是在渲染之后,进行resize,那么就需要将option和resize放在一个定时器中,保持在同一个队列

     chartInit(chart) {
          let this_ = this;
          if(this.chart){
            this.chart.clear();
          }else{
            this.chart = this.$refs.chart;
          }; 
         
          // must resize chart in nextTick
          this.$nextTick(() => {
            setTimeout(()=>{
              this_.options = ChartConfig(this_.chartData,this_.chartType);
              this_.resizeChart();
            },300);
          });
     },
    
    resizeChart() {
          this.chart && this.chart.resize();
    },
  • 相关阅读:
    javascript对象继承的实现
    浏览器兼容问题汇总<转>
    DOM笔记
    Ajax日记
    学习态度
    项目1
    导航项目-整体布局
    有关布局
    导航项目开始
    windows 服务 定时程序 跑不出数据
  • 原文地址:https://www.cnblogs.com/fyjz/p/14578170.html
Copyright © 2011-2022 走看看