From 8a9ca498d70a0a4f66c073fe869fc6d8a3e79a55 Mon Sep 17 00:00:00 2001
From: Vben <anncwb@126.com>
Date: 星期四, 25 二月 2021 20:25:02 +0800
Subject: [PATCH] chore: remove useless code

---
 src/hooks/web/useApexCharts.ts |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/hooks/web/useApexCharts.ts b/src/hooks/web/useApexCharts.ts
index 34fb20e..cbee7b7 100644
--- a/src/hooks/web/useApexCharts.ts
+++ b/src/hooks/web/useApexCharts.ts
@@ -2,8 +2,6 @@
 import { tryOnUnmounted } from '/@/utils/helper/vueHelper';
 import { unref, Ref, nextTick } from 'vue';
 
-import ApexCharts from 'apexcharts';
-
 interface CallBackFn {
   (instance: Nullable<ApexCharts>): void;
 }
@@ -13,21 +11,22 @@
 
   function setOptions(options: any, callback?: CallBackFn) {
     nextTick(() => {
-      useTimeoutFn(() => {
+      useTimeoutFn(async () => {
         const el = unref(elRef);
 
         if (!el || !unref(el)) return;
+        const ApexCharts = await (await import('apexcharts')).default;
         chartInstance = new ApexCharts(el, options);
 
         chartInstance && chartInstance.render();
 
-        // setOptions澧炲姞callback鏂规硶锛岃繑鍥瀋hartInstance锛屼互渚夸簬瀵瑰浘琛ㄨ繘琛屽啀鎿嶄綔锛屼緥濡傝皟鐢╱pdateOptions鏂规硶鏇存柊鍥捐〃
+        // The callback method is added to setOptions to return the chartInstance to facilitate the re-operation of the chart, such as calling the updateOptions method to update the chart
         callback && callback(chartInstance);
       }, 30);
     });
   }
 
-  // 鏂板璋冪敤ApexCharts鐨剈pdateOptions鏂规硶鏇存柊鍥捐〃
+  // Call the updateOptions method of ApexCharts to update the chart
   function updateOptions(
     chartInstance: Nullable<ApexCharts>,
     options: any,

--
Gitblit v1.8.0