![](https://img2022.cnblogs.com/blog/2158757/202205/2158757-20220531172345798-694325836.png)
出现echarts超出父盒子宽度的问题
在了解echarts绘制机制
echarts图形只绘制一次,且绘制时自动获取父级大小填写宽度
原代码
mounted () { // setTimeout(() => { this.$refs.GaugeChartBox.changeCpu() this.$refs.GaugeChartBox.changeMemory() this.$refs.GaugeChartBox.changeStorage() this.$refs.IPSECSessions.sessionsEcharts() this.$refs.IPSECFlow.flowEcharts() // }, 20) },
使用setTimeout
mounted () { setTimeout(() => { this.$refs.GaugeChartBox.changeCpu() this.$refs.GaugeChartBox.changeMemory() this.$refs.GaugeChartBox.changeStorage() this.$refs.IPSECSessions.sessionsEcharts() this.$refs.IPSECFlow.flowEcharts() }, 20) },