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