问题:vue在一个页面引入多个echarts组件时,仅最后一个组件执行了自适应
原因:子组件中的window.onresize
只获取到了最后一个echarts
解决办法: 将子组件echarts定义在data中,然后再父组件中通过ref调用其resize()函数
window.addEventListener('resize',()=>{
this.$refs.day.charts.resize()
this.$refs.mon.charts.resize()
this.$refs.year.charts.resize()
})