From c84d328cb6448786aee00f1b0684aaa07186e410 Mon Sep 17 00:00:00 2001 From: whyczyk <525500596@qq.com> Date: 星期四, 04 三月 2021 10:56:56 +0800 Subject: [PATCH] chart字体自适应 --- src/components/charts/prossPieChart.vue | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/charts/prossPieChart.vue b/src/components/charts/prossPieChart.vue index 392eaed..f90b15e 100644 --- a/src/components/charts/prossPieChart.vue +++ b/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瀹炰緥 -- Gitblit v1.9.1