diff --git a/runtime/tmagic-form/src/useFormConfig.ts b/runtime/tmagic-form/src/useFormConfig.ts index c99b49e7..9269b70f 100644 --- a/runtime/tmagic-form/src/useFormConfig.ts +++ b/runtime/tmagic-form/src/useFormConfig.ts @@ -23,7 +23,7 @@ export const useFormConfig = (props: AppProps) => { // @ts-ignore const formConfig = computed(() => props.fillConfig((config.value?.items || []) as FormConfig, mForm)); - const app: Core | undefined = new Core({ + let app: Core | undefined = new Core({ ua: contentWindow?.navigator.userAgent, platform: 'editor', }); @@ -137,6 +137,7 @@ export const useFormConfig = (props: AppProps) => { contentWindow?.addEventListener('message', runtimeReadyHandler); onBeforeUnmount(() => { + app = undefined; contentWindow?.removeEventListener('message', runtimeReadyHandler); });