File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
designer/src/builtin-simulator
react-simulator-renderer/src Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
190190 this . componentsConsumer = new ResourceConsumer < Asset | undefined > ( ( ) => this . componentsAsset ) ;
191191 this . injectionConsumer = new ResourceConsumer ( ( ) => {
192192 return {
193+ appHelper : engineConfig . get ( 'appHelper' ) ,
193194 i18n : this . project . i18n ,
194195 } ;
195196 } ) ;
Original file line number Diff line number Diff line change @@ -208,6 +208,15 @@ export interface EngineOptions {
208208 // 是否开启在 render 阶段开启 filter reducer,默认值:false
209209 enableFilterReducerInRenderStage ?: boolean ;
210210 } ;
211+ /**
212+ * 与 react-renderer 的 appHelper 一致, https://lowcode-engine.cn/docV2/nhilce#appHelper
213+ */
214+ appHelper ?: {
215+ /** 全局公共函数 */
216+ utils ?: Record < string , any > ;
217+ /** 全局常量 */
218+ constants ?: Record < string , any > ;
219+ } ;
211220
212221 requestHandlersMap : RequestHandlersMap ;
213222}
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import { createMemoryHistory, MemoryHistory } from 'history';
2525import Slot from './builtin-components/slot' ;
2626import Leaf from './builtin-components/leaf' ;
2727import { withQueryParams , parseQuery } from './utils/url' ;
28+ import { merge } from 'lodash' ;
2829
2930const loader = new AssetLoader ( ) ;
3031configure ( { enforceActions : 'never' } ) ;
@@ -308,6 +309,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
308309 ...this . _appContext ,
309310 } ;
310311 newCtx . utils . i18n . messages = data . i18n || { } ;
312+ merge ( newCtx , data . appHelper || { } ) ;
311313 this . _appContext = newCtx ;
312314 } ) ;
313315 }
You can’t perform that action at this time.
0 commit comments