From 808d25d1eb6f794aad85712c928ff66a7e07cce3 Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Thu, 9 Mar 2023 15:28:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(amis-saas-9318):=20=E6=94=AF=E6=8C=81react1?= =?UTF-8?q?8;=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E9=85=8D=E7=BD=AE=E9=A1=B9=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I093d58b6ce914eb6905a28a07e878f679c6e01a3 --- .../src/component/IFrameBridge.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/amis-editor-core/src/component/IFrameBridge.tsx b/packages/amis-editor-core/src/component/IFrameBridge.tsx index 49e03c5ee..2d5880e1d 100644 --- a/packages/amis-editor-core/src/component/IFrameBridge.tsx +++ b/packages/amis-editor-core/src/component/IFrameBridge.tsx @@ -1,8 +1,8 @@ import {observer} from 'mobx-react'; import {isAlive} from 'mobx-state-tree'; import React from 'react'; -import {unmountComponentAtNode} from 'react-dom'; -// import {createRoot} from 'react-dom/client'; +// import {unmountComponentAtNode} from 'react-dom'; +import {createRoot} from 'react-dom/client'; import {EditorManager} from '../manager'; import {EditorStoreType} from '../store/editor'; import {autobind, guid} from '../util'; @@ -156,20 +156,21 @@ export function mountInIframe( const bridgeName = location.hash.substring(1); + /* // react 18 版本以下的 render方法 reactDom.render( , dom ); - - /* + */ + // react 18 render方法 const root = createRoot(dom); root.render(); - */ + window.onunload = function () { - unmountComponentAtNode(dom); - // root.unmount(); // react18 + // unmountComponentAtNode(dom); + root.unmount(); // react18 }; }