From 03e959696ecf412e3c062cda1e16f068be9f162a Mon Sep 17 00:00:00 2001 From: Cosmos Date: Mon, 30 Oct 2023 13:11:41 +0800 Subject: [PATCH] fix: echarts resize error (#622) --- src/hooks/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 3c26653..cd5a8d0 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1,16 +1,14 @@ import * as echarts from 'echarts/core'; -import { onMounted, onUnmounted, Ref, ref } from 'vue'; +import { onMounted, onUnmounted, Ref, ref, ShallowRef, shallowRef } from 'vue'; /** * eChart hook * @param domId - * @param chart */ -export const useChart = (domId: string): Ref => { +export const useChart = (domId: string): ShallowRef => { let chartContainer: HTMLCanvasElement; - const selfChart = ref(); + const selfChart = shallowRef(); const updateContainer = () => { - // TODO resize 报错,响应式的问题,待处理 selfChart.value.resize({ width: chartContainer.clientWidth, height: chartContainer.clientHeight,