0
点赞
收藏
分享

微信扫一扫

Echarts显示隐藏导致大小错误的Bug记录

未定义变量 2021-09-27 阅读 46
日记本

原因

解决方案

for (const [containerId, { option, config }] of this
              .echartsOptions) {
              this.$nextTick(() => {
                let dom = document.getElementById(containerId);
                let { width, height } = dom.getBoundingClientRect();
                let myChart = this.$echarts.init(dom, "light");
                myChart.clear();
                myChart.resize();
                myChart.setOption(option, config);
              });
            }

原理

  • myChart.clear();清空画布
  • myChart.resize();重置大小
举报

相关推荐

0 条评论