From 872c978b9b471e8e1bc2f42d8ce0865def159950 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Thu, 11 Apr 2024 17:23:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20floating-box=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/hooks/use-editor-content-height.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/editor/src/hooks/use-editor-content-height.ts b/packages/editor/src/hooks/use-editor-content-height.ts index 0c69cfb9..d582a9ee 100644 --- a/packages/editor/src/hooks/use-editor-content-height.ts +++ b/packages/editor/src/hooks/use-editor-content-height.ts @@ -1,4 +1,4 @@ -import { computed, inject, ref, watchEffect } from 'vue'; +import { computed, inject, ref, watch } from 'vue'; import type { Services } from '@editor/type'; @@ -9,10 +9,16 @@ export const useEditorContentHeight = () => { const editorContentHeight = computed(() => frameworkHeight.value - navMenuHeight.value); const height = ref(0); - watchEffect(() => { - if (height.value > 0 && height.value === editorContentHeight.value) return; - height.value = editorContentHeight.value; - }); + watch( + editorContentHeight, + () => { + if (height.value > 0 && height.value === editorContentHeight.value) return; + height.value = editorContentHeight.value; + }, + { + immediate: true, + }, + ); return { height,