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 },