From 898c836c57c22b9439321e96650f8a35b1cea917 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sun, 13 Apr 2025 08:07:06 +0800
Subject: [PATCH] feat: 添加echartsResize hooks,添加ztzf组件样式

---
 src/views/TaskManage/TaskTop/TaskIndustry.vue |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/views/TaskManage/TaskTop/TaskIndustry.vue b/src/views/TaskManage/TaskTop/TaskIndustry.vue
index 326d6b8..ad47c8e 100644
--- a/src/views/TaskManage/TaskTop/TaskIndustry.vue
+++ b/src/views/TaskManage/TaskTop/TaskIndustry.vue
@@ -9,8 +9,9 @@
 <script setup>
 import * as echarts from 'echarts';
 import { industryJobNumPieChart } from '@/api/home/task';
+import useEchartsResize from '@/hooks/useEchartsResize'
 const chartRef = ref(null);
-let chart = null;
+let { chart } = useEchartsResize(chartRef)
 
 const option = {
   tooltip: {
@@ -73,7 +74,7 @@
         item.value = matchData.value;
       }
     });
-    chart.setOption(option);
+    chart.value.setOption(option);
   });
 };
 
@@ -90,23 +91,13 @@
 //       }
 //     }));
 //     option.series[0].data = data;
-//     chart.setOption(option);
+//     chart.value.setOption(option);
 //   });
 // };
 
 
 onMounted(() => {
-  chart = echarts.init(chartRef.value);
   getIndustryJobNumPieChart();
-  
-  window.addEventListener('resize', () => {
-    chart?.resize();
-  });
-});
-
-onUnmounted(() => {
-  window.removeEventListener('resize', chart?.resize);
-  chart?.dispose();
 });
 </script>
 
@@ -116,7 +107,7 @@
   width: 244px;
   height: 100%;
   .title {
-    margin-top: 10px; 
+    margin-top: 10px;
     width: 244px;
     height: 26px;
     background: url('@/assets/images/task/title.png') no-repeat center / 100% 100%;
@@ -129,4 +120,4 @@
     height: 200px;
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3