Ovilia edited a comment on issue #9305: Uncaught DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0. URL: https://github.com/apache/incubator-echarts/issues/9305#issuecomment-471398658 这个问题的本质原因是点击「加载地图」后没有销毁 resize 事件。 ```js $(window).resize(function() { setTimeout(function (){mapCharts.resize(); }, 500); }); ``` 调用到 `mapCharts.resize` 时,这个对象还是存在的,但是对应的 DOM 节点已经不存在了,所以宽高是 0。 ECharts 这边可以做个优化,在 `drawImage` 的时候判断下是不是有宽高,没有就不画。但本质原因是应该销毁对 window resize 事件的监听。
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
