前言
在代码没有报错的情况下,echarts图表没有显示出来,并给出警告:
Can‘t get DOM width or height. Please check dom.clientWidth and dom.clientHeight.
解决
- 该警告的意思是:echarts图表显示区域没有获取到父级盒子的宽度或高度,故图形无法显示出来。
- 因此,我们在显示echarts图表的盒子处设置宽高即可正常显示图表。
<div class="charts" id="charts" style="height:100%;width:100%;"></div>