报错信息
[ECharts] Can't get DOM width or height. Please check dom.clientWidth and dom.clientHeight. They should not be 0.For example, you may need to call this in the callback of window.onload.
表示获取图表容器的宽度和高度时出现了问题。ECharts 无法正确获取到容器的尺寸,可能是因为容器元素的 clientWidth 和 clientHeight 值为 0
解决方法
1.使用nexTick
mounted() {
this.$nextTick(()=>{
this.renderEchats()
})
},
2.使用setTimeout
mounted() {
setTimeout(() => {
this.renderEchats()
}, 500)
},