1 drawLine(data){ 7 that.myChartA = echarts.init(document.getElementById(obj)) 8 that.myChartA.setOption(option,true) //画图 9 that.addLoadEvent(that.myChartA.resize); //添加 监听屏幕缩放 10 setTimeout(function(){ 11 that.myChartA.resize(); 12 },1) 13 }, 14 addLoadEvent(fn){ 15 let that = this; 16 var old = window.onresize; 17 if(typeof window.onresize != ‘function‘){ //防止多个window.onresize 冲突 解决 18 window.onresize = fn; 19 }else{ 20 window.onresize = function(){ 21 old(); 22 setTimeout(function(){ //个别时候无法刷新echarts 延迟1MS 解决 23 fn(); 24 },1) 25 } 26 } 27 },
原文地址:https://www.cnblogs.com/zlq92/p/10214548.html
时间: 2024-11-07 22:53:08