From b676cb185ba19e8c30a7d70c9242077d697f3829 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Wed, 25 Nov 2026 20:31:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20TextContent=20=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client-base/src/components/textbox.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages-user/client-base/src/components/textbox.tsx b/packages-user/client-base/src/components/textbox.tsx index 89ed635..ed8d836 100644 --- a/packages-user/client-base/src/components/textbox.tsx +++ b/packages-user/client-base/src/components/textbox.tsx @@ -131,16 +131,6 @@ export const TextContent = defineComponent< } }; - watch( - root, - (value, old) => { - old?.excitation.remove(typer.value); - value?.excitation.add(typer.value); - retype(); - }, - { immediate: true } - ); - /** 从头开始重新打字 */ const retype = () => { if (needUpdate || props.hidden) return; @@ -184,6 +174,16 @@ export const TextContent = defineComponent< watch(width, updateLoc); + watch( + root, + (value, old) => { + old?.excitation.remove(typer.value); + value?.excitation.add(typer.value); + retype(); + }, + { immediate: true } + ); + expose({ retype, showAll, getHeight }); const renderContent = (canvas: MotaOffscreenCanvas2D) => {