Closed gauseen closed 1 year ago
如下,设置初始模拟器类型,不生效
project.onSimulatorHostReady((simulator) => { simulator?.set('device', 'phone'); });
git clone https://github.com/alibaba/lowcode-demo.git cd demo-antd-pro-with-formily tnpm i tnpm start
在 src/plugin-component-panel/index.tsx 代码里增加 simulator?.set('device', 'phone') 逻辑,如下
simulator?.set('device', 'phone')
import ComponentsPane from '@alilc/lowcode-plugin-components-pane'; import { IPublicModelPluginContext } from '@alilc/lowcode-types'; const ComponentPanelPlugin = (ctx: IPublicModelPluginContext) => { return { async init() { const { skeleton, project } = ctx; // 注册左边组件入口 const componentsPane = skeleton.add({ area: 'leftArea', type: 'PanelDock', name: 'componentsPane', content: ComponentsPane, contentProps: {}, props: { align: 'top', icon: 'zujianku', description: '组件库', }, }); componentsPane?.disable?.(); project.onSimulatorRendererReady(() => { componentsPane?.enable?.(); }); project.onSimulatorHostReady((simulator) => { simulator?.set('device', 'phone'); }); }, }; }; ComponentPanelPlugin.pluginName = 'ComponentPanelPlugin'; export default ComponentPanelPlugin;
希望初始模拟器可配置移动类型
初始化设置模拟器为 phone 时不生效,模拟器画布依然很宽,不是移动端的画布
(this information can be collected via the manual plugin / 版本信息可通过低代码用户手册插件收集)
Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题
init(document.getElementById('lce-container')!, { device: 'phone', ...
这里设置即可
Describe the bug (required) / 详细描述 bug(必填)
如下,设置初始模拟器类型,不生效
To Reproduce (required) / 如何复现 bug?(必填,非常重要)
在 src/plugin-component-panel/index.tsx 代码里增加
simulator?.set('device', 'phone')
逻辑,如下Expected behavior (required) / 预期行为(必填,非常重要)
希望初始模拟器可配置移动类型
Screenshots (optional) / bug 截图(可选)
初始化设置模拟器为 phone 时不生效,模拟器画布依然很宽,不是移动端的画布
Environments (please complete the following information) (required): / 请提供如下信息(必填)
Additional context (optional) / 更多额外信息(可选)
Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题