From 78bd81ea5da00073f4f925d963840ef798fe72f0 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Wed, 1 Jun 2022 15:39:28 +0800 Subject: [PATCH] fix dom --- src/hooks/useEcharts.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hooks/useEcharts.ts b/src/hooks/useEcharts.ts index 16b505b2..01f7d7ed 100644 --- a/src/hooks/useEcharts.ts +++ b/src/hooks/useEcharts.ts @@ -79,7 +79,11 @@ export function useECharts( if (!el || !unref(el)) { return; } + const { width, height } = el.getBoundingClientRect(); + if (!width || !height) { + return; + } chartInstance = echarts.init(el, t); const { removeEvent } = useEventListener({ el: window,