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) => {