重點在於 echarts.getInstanceByDom 這個 API
我的js:
// 懶加載優化:滾動節流策略 var __SCROLLTIMER__ = null // 重新設置 echarts 的寬高 var resizeEcharts = () => { $('[_echarts_instance_]').each((i, e) => { echarts.getInstanceByDom(e).resize() }) } // 綁定事件 window.onresize = function () { clearTimeout(__SCROLLTIMER__); __SCROLLTIMER__ = setTimeout(resizeEcharts, 150); }