页面结构:
<div id="echarts_pie2" class="charts" :style="{height:vheight+ 'px',width:vwidth + 'px' }"></div>
js方法:
vheight:220,
vwidth:220,
this.vWidth = document.body.clientWidth - 20;
this.vheight = document.body.clientHeight - 20;
trendChart.resize({width:this.vWidth,height:this.vheight});
另外附带echarts点击空白处方法:
myChart.getZr().on('click', params => {
if(params.target) {
console.log("非空白");
}else{
console.log("空白");
}
})