echarts初始化隐藏时,不能设置width:100%不能撑起页面,需要通过动态获取对应的宽度,设置宽度,再初始化echarts

如:
<div ref="echart" class="echart" v-show="!showBz"></div>
<div ref="echart1" class="echart" v-show="showBz" :style="{width:${fullW}px}"></div>

this.fullW=this.$refs.echart.clientWidth;
this.myChart1 = echarts.init(this.$refs.echart1);


墨子鱼
16 声望1 粉丝