mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
feat: 支持在 host 里刷新渲染器
This commit is contained in:
parent
bf4302b381
commit
ccbbf743ad
@ -309,6 +309,11 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
return libraryAsset;
|
||||
}
|
||||
|
||||
rerender() {
|
||||
this.designer.refreshComponentMetasMap();
|
||||
this.renderer?.rerender?.();
|
||||
}
|
||||
|
||||
async mountContentFrame(iframe: HTMLIFrameElement | null) {
|
||||
if (!iframe || this._iframe === iframe) {
|
||||
return;
|
||||
|
||||
@ -388,12 +388,18 @@ export class Designer {
|
||||
this.editor.set('assets', newAssets);
|
||||
}
|
||||
// TODO: 因为涉及修改 prototype.view,之后在 renderer 里修改了 vc 的 view 获取逻辑后,可删除
|
||||
this._componentMetasMap = new Map(this._componentMetasMap);
|
||||
this.refreshComponentMetasMap();
|
||||
// 完成加载增量资源后发送事件,方便插件监听并处理相关逻辑
|
||||
this.editor.emit('designer.incrementalAssetsReady');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新 componentMetasMap,可间接触发模拟器里的 buildComponents
|
||||
*/
|
||||
refreshComponentMetasMap() {
|
||||
this._componentMetasMap = new Map(this._componentMetasMap);
|
||||
}
|
||||
|
||||
get(key: string): any {
|
||||
return this.props ? this.props[key] : null;
|
||||
|
||||
@ -474,6 +474,14 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
host.project.setRendererReady(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新渲染器
|
||||
*/
|
||||
rerender() {
|
||||
// TODO: 不太优雅
|
||||
this._appContext = { ...this._appContext };
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.disposeFunctions.forEach(fn => fn());
|
||||
this.documentInstances.forEach(docInst => docInst.dispose());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user