From a9cead0339e253752c7bbd33c069286335a4a671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=9B=E7=9A=93?= Date: Wed, 14 Apr 2021 11:18:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=20components=20?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E8=A7=86=E5=9B=BE=E5=88=B7=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=9C=BA=E5=88=B6,=20designer=20=5FcomponentMetasMap=20?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E6=9B=B4=E6=96=B0=E6=89=8D=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=20renderer=20components=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/designer/src/builtin-simulator/host.ts | 1 - packages/designer/src/designer/designer.ts | 4 ++-- packages/react-simulator-renderer/src/renderer.ts | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/designer/src/builtin-simulator/host.ts b/packages/designer/src/builtin-simulator/host.ts index fff3413fa..82b6c86e9 100644 --- a/packages/designer/src/builtin-simulator/host.ts +++ b/packages/designer/src/builtin-simulator/host.ts @@ -353,7 +353,6 @@ export class BuiltinSimulatorHost implements ISimulatorHost(); + @obx.ref private _componentMetasMap = new Map(); private _lostComponentMetasMap = new Map(); diff --git a/packages/react-simulator-renderer/src/renderer.ts b/packages/react-simulator-renderer/src/renderer.ts index f18807148..7fc7586b0 100644 --- a/packages/react-simulator-renderer/src/renderer.ts +++ b/packages/react-simulator-renderer/src/renderer.ts @@ -309,9 +309,9 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { ...this._components, }; } - private _components: any = {}; + @obx.ref private _components: any = {}; - get components(): object { + @computed get components(): object { // 根据 device 选择不同组件,进行响应式 // 更好的做法是,根据 device 选择加载不同的组件资源,甚至是 simulatorUrl return this._components;