From 21933d0857b7539cfaff52a88a3340772160c4e7 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 06 十二月 2024 11:52:06 +0800
Subject: [PATCH] 大屏自适应

---
 src/views/screen/components/lineChart.vue |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/views/screen/components/lineChart.vue b/src/views/screen/components/lineChart.vue
index f748faa..c112c09 100644
--- a/src/views/screen/components/lineChart.vue
+++ b/src/views/screen/components/lineChart.vue
@@ -23,6 +23,12 @@
   },
 
   methods: {
+    setFontSize(res){
+      const clientWidth = window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
+      if (!clientWidth) return;
+      let fontSize = clientWidth / 1920;
+      return res*fontSize;
+    },
     initDrawLine() {
       const that = this
       let option = {
@@ -38,7 +44,7 @@
             return str
           },
           textStyle: {
-            fontSize: 16
+            fontSize: this.setFontSize(16)
           }
         },
 
@@ -49,7 +55,7 @@
           data: ['宸插鐞嗗伐鍗曟暟', '鏈鐞嗗伐鍗曟暟'],
           textStyle: {
             color: '#A0AEC0',
-            fontSize: 14
+            fontSize: this.setFontSize(14)
           }
         },
 
@@ -68,7 +74,7 @@
           },
           axisLabel: {
             color: '#A0AEC0',
-            fontSize: 14,
+            fontSize: this.setFontSize(14),
             margin: 20,
             rotate: 30
           },
@@ -89,7 +95,7 @@
           },
           axisLabel: {
             color: '#A0AEC0',
-            fontSize: 14,
+            fontSize: this.setFontSize(14),
             margin: 5
           }
         },

--
Gitblit v1.8.0