mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 00:48:16 +00:00
feat: sync utils/constants for react-simulator-renderer
This commit is contained in:
parent
bdd6a4789d
commit
91252fa1b0
@ -189,6 +189,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
this.componentsConsumer = new ResourceConsumer<Asset | undefined>(() => this.componentsAsset);
|
||||
this.injectionConsumer = new ResourceConsumer(() => {
|
||||
return {
|
||||
appHelper: engineConfig.get('appHelper'),
|
||||
i18n: this.project.i18n,
|
||||
};
|
||||
});
|
||||
|
||||
@ -81,6 +81,17 @@ export interface EngineOptions {
|
||||
// 是否开启在 render 阶段开启 filter reducer,默认值:false
|
||||
enableFilterReducerInRenderStage?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* 与 react-renderer 的 appHelper 一致, https://lowcode-engine.cn/docV2/nhilce#appHelper
|
||||
*/
|
||||
appHelper?: {
|
||||
/** 全局公共函数 */
|
||||
utils?: Record<string, any>;
|
||||
/** 全局常量 */
|
||||
constants?: Record<string, any>;
|
||||
};
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
@ -91,7 +102,7 @@ export class EngineConfig {
|
||||
string,
|
||||
Array<{
|
||||
once?: boolean;
|
||||
resolve:(data: any) => void;
|
||||
resolve: (data: any) => void;
|
||||
}>
|
||||
>();
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ import { createMemoryHistory, MemoryHistory } from 'history';
|
||||
import Slot from './builtin-components/slot';
|
||||
import Leaf from './builtin-components/leaf';
|
||||
import { withQueryParams, parseQuery } from './utils/url';
|
||||
import { merge } from 'lodash';
|
||||
|
||||
const loader = new AssetLoader();
|
||||
configure({ enforceActions: 'never' });
|
||||
@ -322,6 +323,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
...this._appContext,
|
||||
};
|
||||
newCtx.utils.i18n.messages = data.i18n || {};
|
||||
merge(newCtx, data.appHelper || {});
|
||||
this._appContext = newCtx;
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user