<!-- 碳排放分析饼图 --> <script lang="ts" setup> import PieChart from '@/components/Echart/PieChart.vue' const props = defineProps({ data: { type: Array as any, defaule: () => { return [] }, }, }) // 饼图数据 const data = ref([]) setTimeout(() => { console.log(props.data, '碳排数据') data.value = props.data }) const picLegend = ref({ show: false, orient: 'horizontal', // bottom: '5%', // left: 'center', icon: 'circle', itemWidth: 12, itemHeight: 12, itemStyle: { fontSize: 18, }, }) const bodyWidth = document.body.clientWidth console.log(bodyWidth, 'bodyHeightbodyHeightbodyHeight') // :width="`${blockWidth - 225}px`" </script> <template> <div style="width: 30%;"> <div>碳排分析</div> <pie-chart :data="data" :width="`${400}px`" height="400px" /> </div> </template>