vue中echarts图表大小适应窗口大小且不需要刷新

xiaoxiao2025-04-07  10

内容如下: // 基于准备好的dom,初始化echarts实例 let myChart = this.$echarts.init(document.getElementById('myChart')) //根据窗口的大小变动图表 --- 重点 window.onresize = function(){ myChart.resize(); //myChart1.resize(); //若有多个图表变动,可多写 } 代码如下: mounted() { const that = this window.onresize = () => {// 根据窗口大小调整曲线大小 let myChart = this.$echarts.init(document.getElementById('myChart')); myChart.resize(); } },

 

转载请注明原文地址: https://www.6miu.com/read-5027673.html

最新回复(0)