mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 05:48:17 +00:00
fix: 调整 components 触发视图刷新的机制, designer _componentMetasMap 引用更新才触发 renderer components 更新
This commit is contained in:
parent
dc5fa1d257
commit
a9cead0339
@ -353,7 +353,6 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
async setupComponents(library) {
|
async setupComponents(library) {
|
||||||
const libraryAsset: AssetList = this.buildLibrary(library);
|
const libraryAsset: AssetList = this.buildLibrary(library);
|
||||||
await this.renderer.load(libraryAsset);
|
await this.renderer.load(libraryAsset);
|
||||||
await this.renderer.buildComponents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupEvents() {
|
setupEvents() {
|
||||||
|
|||||||
@ -388,7 +388,7 @@ export class Designer {
|
|||||||
this.editor.set('assets', newAssets);
|
this.editor.set('assets', newAssets);
|
||||||
}
|
}
|
||||||
// TODO: 因为涉及修改 prototype.view,之后在 renderer 里修改了 vc 的 view 获取逻辑后,可删除
|
// TODO: 因为涉及修改 prototype.view,之后在 renderer 里修改了 vc 的 view 获取逻辑后,可删除
|
||||||
this._componentMetasMap = new Map(this._componentMetasMap);
|
// this._componentMetasMap = new Map(this._componentMetasMap);
|
||||||
// 完成加载增量资源后发送事件,方便插件监听并处理相关逻辑
|
// 完成加载增量资源后发送事件,方便插件监听并处理相关逻辑
|
||||||
this.editor.emit('designer.incrementalAssetsReady');
|
this.editor.emit('designer.incrementalAssetsReady');
|
||||||
|
|
||||||
@ -433,7 +433,7 @@ export class Designer {
|
|||||||
this.project.load(schema);
|
this.project.load(schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx.val private _componentMetasMap = new Map<string, ComponentMeta>();
|
@obx.ref private _componentMetasMap = new Map<string, ComponentMeta>();
|
||||||
|
|
||||||
private _lostComponentMetasMap = new Map<string, ComponentMeta>();
|
private _lostComponentMetasMap = new Map<string, ComponentMeta>();
|
||||||
|
|
||||||
|
|||||||
@ -309,9 +309,9 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
...this._components,
|
...this._components,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
private _components: any = {};
|
@obx.ref private _components: any = {};
|
||||||
|
|
||||||
get components(): object {
|
@computed get components(): object {
|
||||||
// 根据 device 选择不同组件,进行响应式
|
// 根据 device 选择不同组件,进行响应式
|
||||||
// 更好的做法是,根据 device 选择加载不同的组件资源,甚至是 simulatorUrl
|
// 更好的做法是,根据 device 选择加载不同的组件资源,甚至是 simulatorUrl
|
||||||
return this._components;
|
return this._components;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user