mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
新增simulatorProps renderEnv
This commit is contained in:
parent
29bc7b8835
commit
17346c7a09
@ -112,6 +112,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
|
||||
readonly designer = this.document.designer;
|
||||
|
||||
@computed get renderEnv(): string {
|
||||
return this.get('renderEnv') || 'default';
|
||||
}
|
||||
|
||||
@computed get device(): string {
|
||||
return this.get('device') || 'default';
|
||||
}
|
||||
@ -221,7 +225,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
const vendors = [
|
||||
// required & use once
|
||||
assetBundle(
|
||||
this.get('environment') || this.device === 'default' ? defaultRaxEnvironment : defaultEnvironment,
|
||||
this.get('environment') || this.renderEnv === 'rax' ? defaultRaxEnvironment : defaultEnvironment,
|
||||
AssetLevel.Environment,
|
||||
),
|
||||
// required & use once
|
||||
@ -232,7 +236,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
assetBundle(this.theme, AssetLevel.Theme),
|
||||
// required & use once
|
||||
assetBundle(
|
||||
this.get('simulatorUrl') || this.device === 'default' ? defaultRaxSimulatorUrl : defaultSimulatorUrl,
|
||||
this.get('simulatorUrl') || this.renderEnv === 'rax' ? defaultRaxSimulatorUrl : defaultSimulatorUrl,
|
||||
AssetLevel.Runtime,
|
||||
),
|
||||
];
|
||||
|
||||
@ -11,6 +11,7 @@ interface DesignerPluginState {
|
||||
componentMetadatas?: any[] | null;
|
||||
library?: any[] | null;
|
||||
extraEnvironment?: any[] | null;
|
||||
renderEnv?: string;
|
||||
}
|
||||
|
||||
export default class DesignerPlugin extends PureComponent<PluginProps, DesignerPluginState> {
|
||||
@ -20,6 +21,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
componentMetadatas: null,
|
||||
library: null,
|
||||
extraEnvironment: null,
|
||||
renderEnv: 'default',
|
||||
};
|
||||
|
||||
private _mounted = true;
|
||||
@ -32,6 +34,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
private async setupAssets() {
|
||||
const { editor } = this.props;
|
||||
const assets = await editor.onceGot('assets');
|
||||
const renderEnv = await editor.onceGot('renderEnv');
|
||||
if (!this._mounted) {
|
||||
return;
|
||||
}
|
||||
@ -40,9 +43,10 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
componentMetadatas: components || [],
|
||||
library: packages || [],
|
||||
extraEnvironment,
|
||||
renderEnv,
|
||||
};
|
||||
this.setState(state);
|
||||
};
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this._mounted = false;
|
||||
@ -59,7 +63,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
|
||||
render(): React.ReactNode {
|
||||
const { editor } = this.props;
|
||||
const { componentMetadatas, library, extraEnvironment } = this.state;
|
||||
const { componentMetadatas, library, extraEnvironment, renderEnv } = this.state;
|
||||
|
||||
if (!library || !componentMetadatas) {
|
||||
// TODO: use a Loading
|
||||
@ -76,6 +80,7 @@ export default class DesignerPlugin extends PureComponent<PluginProps, DesignerP
|
||||
simulatorProps={{
|
||||
library,
|
||||
extraEnvironment,
|
||||
renderEnv,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user