重点在于 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); }