whyczyk
2021-03-04 c84d328cb6448786aee00f1b0684aaa07186e410
src/components/charts/prossPieChart.vue
@@ -8,11 +8,14 @@
<script>
  import * as echarts from 'echarts';
  //引入提示框
  import "echarts/lib/component/tooltip";
  //引入chart字体自适应
  import {
    chartFontsize
  } from '@/assets/js/chartFontsize'
  export default {
    name: "prossPieChart",
    chart: "",
    chartData: [],
    props: {
      id: {
        require: true,
@@ -30,6 +33,7 @@
        this.$options.chart.setOption(opt);
      },
      setData(sendData) {
        this.$options.chartData = sendData;
        let color = sendData.color;
        let data = sendData.data;
        let text;
@@ -47,7 +51,7 @@
            textStyle: {
              rich: {
                a: {
                  fontSize: 16,
                  fontSize: chartFontsize(16),
                  color: '#ffffff'
                },
              }
@@ -135,7 +139,7 @@
                normal: {
                  show: true,
                  position: "center",
                  fontSize: 14,
                  fontSize: chartFontsize(24),
                  fontWeight: '600',
                  color: '#ffffff'
                }
@@ -167,7 +171,8 @@
      },
      resize() {
        this.$options.chart.resize();
      }
        this.setData(this.$options.chartData);
      },
    },
    mounted() {
      // 基于准备好的dom,初始化echarts实例