vue中动态设置echarts画布大小
document.getElementById('news-shopPagechart').style.height = this.heightpx2+'px'; //heightpx2定义在data中,用于动态设置高度 let shopCharts = this.$echarts.init( document.getElementById("news-shopPagechart") ); shopCharts.resize();//直接加这句即可 shopCharts.setOption({...})