vue使用echarts自适应报错 Uncaught TypeError: Cannot read property ‘resize‘ of undefined

把  _this.myChart.resize()  改为 if (_this.myChart) _this.myChart.resize(); 就可以了。

window.addEventListener("resize", function () {
        // _this.myChart.resize(); // y原先的写法图表自适应的一个方法
        if (_this.myChart) _this.myChart.resize(); //现在的写法
      });

猜你喜欢

转载自blog.csdn.net/CMDN123456/article/details/133311427