mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 09:41:57 +00:00
Merge branch 'fix/load-async-library' into 'release/1.0.0'
Fix/load async library See merge request !1033739
This commit is contained in:
commit
17cbdeaa88
@ -209,7 +209,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
return {};
|
||||
});
|
||||
|
||||
readonly asycnLibraryMap: { [key: string]: {} } = {};
|
||||
readonly asyncLibraryMap: { [key: string]: {} } = {};
|
||||
|
||||
readonly libraryMap: { [key: string]: string } = {};
|
||||
|
||||
@ -230,7 +230,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
library.forEach((item) => {
|
||||
this.libraryMap[item.package] = item.library;
|
||||
if (item.async) {
|
||||
this.asycnLibraryMap[item.package] = item;
|
||||
this.asyncLibraryMap[item.package] = item;
|
||||
}
|
||||
if (item.urls) {
|
||||
libraryAsset.push(item.urls);
|
||||
@ -260,8 +260,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
// wait 准备 iframe 内容、依赖库注入
|
||||
const renderer = await createSimulator(this, iframe, vendors);
|
||||
|
||||
// 加载异步Library
|
||||
await renderer.loadAsyncLibrary(this.asycnLibraryMap);
|
||||
|
||||
// TODO: !!! thinkof reload onloa
|
||||
|
||||
// wait 业务组件被第一次消费,否则会渲染出错
|
||||
@ -270,6 +269,9 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
// wait 运行时上下文
|
||||
await this.injectionConsumer.waitFirstConsume();
|
||||
|
||||
// 加载异步Library
|
||||
await renderer.loadAsyncLibrary(this.asyncLibraryMap);
|
||||
|
||||
// step 5 ready & render
|
||||
renderer.run();
|
||||
|
||||
|
||||
@ -111,9 +111,7 @@ export default class FunctionSetter extends PureComponent<FunctionSetterProps> {
|
||||
|
||||
parseFunctionName = (functionString: string) => {
|
||||
// 因为函数格式是固定的,所以可以按照字符换去匹配获取函数名
|
||||
const funNameStr = functionString.split('this.')[1].split('.')[0];
|
||||
|
||||
return funNameStr;
|
||||
return functionString.split('this.')[1]?.split('.')[0];
|
||||
};
|
||||
|
||||
parseFunctionParam = (functionString:string) => {
|
||||
|
||||
@ -42,7 +42,7 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
|
||||
if (this._libraryMap !== host.libraryMap || this._componentsMap !== host.designer.componentsMap) {
|
||||
this._libraryMap = host.libraryMap || {};
|
||||
this._componentsMap = host.designer.componentsMap;
|
||||
// this.buildComponents();
|
||||
this.buildComponents();
|
||||
}
|
||||
|
||||
// sync designMode
|
||||
@ -141,10 +141,9 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
|
||||
return loader.load(asset);
|
||||
}
|
||||
|
||||
async loadAsyncLibrary(asycnLibraryMap) {
|
||||
const promise = await loader.loadAsyncLibrary(asycnLibraryMap);
|
||||
async loadAsyncLibrary(asyncLibraryMap) {
|
||||
await loader.loadAsyncLibrary(asyncLibraryMap);
|
||||
this.buildComponents();
|
||||
return promise;
|
||||
}
|
||||
|
||||
private instancesMap = new Map<string, ReactInstance[]>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user