diff --git a/src/components/echartsPie.vue b/src/components/echartsPie.vue index fd2ffa8..9ebc812 100644 --- a/src/components/echartsPie.vue +++ b/src/components/echartsPie.vue @@ -1,10 +1,10 @@ @@ -55,7 +55,69 @@ export default { // 获取配置 getOption() { // 指定图表的配置项和数据 - let option = { + let isAllZero = this.dataList.every(item => { + // console.log(item,"item") + return item.value == 0 + }) + console.log(isAllZero,"isAllZero") + let option=null + if(isAllZero==true){ + for(let i =0;i{ + this.$nextTick(() => { + this.myChart = echarts.init(document.getElementById(this.id)); // 使用刚指定的配置项和数据显示图表。 this.myChart.setOption(this.getOption()); }); let that = this; window.addEventListener('resize', function () { - console.log("addEventListener"); + //console.log("addEventListener"); // 让我们的图表调用 resize这个方法 //that.$nextTick(()=>{ - that.myChart.resize(); + that.myChart.resize(); //}); }); }, // 更新图表 updateEcharts() { - this.myChart.setOption(this.getOption(),true); + this.myChart.setOption(this.getOption(), true); + console.log( this.dataList," this.dataList") } } } @@ -126,16 +194,18 @@ export default { width: 100%; height: 100%; display: flex; + .echarts_box { flex-shrink: 0; } + .list_box { display: flex; flex-direction: column; height: 100%; overflow-y: scroll; padding: 50px 50px; - box-sizing:border-box; + box-sizing: border-box; } }