1

<template lang="html">
<div class="chart chart-water">

<div ref="chartWater"></div>

</div>
</template>

<script>
import 'echarts-liquidfill';
import * as chart from 'assets/js/echart-config';
export default {
props: {

chartTitle: {
  type: String,
  required: false,
  default: '已检测APP平均合规分数'
},
sourceInfo: {
  type: Number,
  required: true,
  default: 0
}

},
data() {

return {
}

},
computed: {

chartDom() {
  return echarts.init(this.$refs.chartWater);
},
optionDom() {
  const option = chart.waterOption(this.sourceInfo, this.chartTitle);
  return option;
}

},
watch: {

sourceInfo: {
  handler(num) {
    this.hideLoading();
    if ( typeof num == 'number' ) {
      this.doRender();
    } else {
      this.chartDom.setOption(chart.emptyOption(this.chartTitle), true);
    }
  },
  deep: true
}

},
methods: {

doRender() {
  this.chartDom.setOption(this.optionDom, true);
},
resize() {
  this.chartDom.resize();
},
showLoading() {
  this.chartDom.showLoading({
    text: '',
    color: '#3988ff',
    textColor: '#000',
    maskColor: 'rgba(255, 255, 255, 0)',
    zlevel: 0
  });
},
hideLoading() {
  this.chartDom.hideLoading();
}

},
mounted() {

this.chartDom.resize(400, 400);
this.showLoading();
window.addEventListener('resize', this.resize);

},
destroyed() {

window.removeEventListener('resize', this.resize);

}
}
</script>

<style lang="scss">
</style>


亲爱的阿乾
885 声望22 粉丝

此时无能为力,此心随波逐流