feat: 新增render notFoundComponent、faultComponent engineConfig配置

This commit is contained in:
zude.hzd 2022-11-27 19:23:29 +08:00 committed by 刘菊萍(絮黎)
parent 73acf6f112
commit fceffce5cd
2 changed files with 10 additions and 0 deletions

View File

@ -258,6 +258,14 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
return engineConfig.get('enableStrictNotFoundMode') ?? false; return engineConfig.get('enableStrictNotFoundMode') ?? false;
} }
get notFoundComponent(): any {
return engineConfig.get('notFoundComponent') ?? null;
}
get faultComponent(): any {
return engineConfig.get('faultComponent') ?? null;
}
@computed get componentsAsset(): Asset | undefined { @computed get componentsAsset(): Asset | undefined {
return this.get('componentsAsset'); return this.get('componentsAsset');
} }

View File

@ -188,6 +188,8 @@ class Renderer extends Component<{
getNode={(id: string) => documentInstance.getNode(id) as Node} getNode={(id: string) => documentInstance.getNode(id) as Node}
rendererName="PageRenderer" rendererName="PageRenderer"
thisRequiredInJSE={host.thisRequiredInJSE} thisRequiredInJSE={host.thisRequiredInJSE}
notFoundComponent={host.notFoundComponent}
faultComponent={host.faultComponent}
customCreateElement={(Component: any, props: any, children: any) => { customCreateElement={(Component: any, props: any, children: any) => {
const { __id, ...viewProps } = props; const { __id, ...viewProps } = props;
viewProps.componentId = __id; viewProps.componentId = __id;