mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 17:57:13 +00:00
fix: 修复低代码组件在设计器中使用时切换移动端视图不生效的问题
This commit is contained in:
parent
7b3b6eb756
commit
a6f3f0c42d
@ -80,7 +80,8 @@ export class Routes extends Component<{ rendererContainer: SimulatorRendererCont
|
|||||||
function ucfirst(s: string) {
|
function ucfirst(s: string) {
|
||||||
return s.charAt(0).toUpperCase() + s.substring(1);
|
return s.charAt(0).toUpperCase() + s.substring(1);
|
||||||
}
|
}
|
||||||
function getDeviceView(view: any, device: string, mode: string) {
|
|
||||||
|
export function getDeviceView(view: any, device: string, mode: string) {
|
||||||
if (!view || typeof view === 'string') {
|
if (!view || typeof view === 'string') {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@ -126,8 +127,8 @@ class Layout extends Component<{ rendererContainer: SimulatorRendererContainer }
|
|||||||
|
|
||||||
@observer
|
@observer
|
||||||
class Renderer extends Component<{
|
class Renderer extends Component<{
|
||||||
rendererContainer: SimulatorRendererContainer,
|
rendererContainer: SimulatorRendererContainer;
|
||||||
documentInstance: DocumentInstance,
|
documentInstance: DocumentInstance;
|
||||||
}> {
|
}> {
|
||||||
startTime: number | null = null;
|
startTime: number | null = null;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import React, { createElement, ReactInstance } from 'react';
|
import React, { createElement, ReactInstance } from 'react';
|
||||||
import { render as reactRender } from 'react-dom';
|
import { render as reactRender } from 'react-dom';
|
||||||
import { host } from './host';
|
import { host } from './host';
|
||||||
import SimulatorRendererView from './renderer-view';
|
import SimulatorRendererView, { getDeviceView } from './renderer-view';
|
||||||
import { computed, observable as obx, untracked, makeObservable, configure } from 'mobx';
|
import { computed, observable as obx, untracked, makeObservable, configure } from 'mobx';
|
||||||
import { getClientRects } from './utils/get-client-rects';
|
import { getClientRects } from './utils/get-client-rects';
|
||||||
import { reactFindDOMNodes, FIBER_KEY } from './utils/react-find-dom-nodes';
|
import { reactFindDOMNodes, FIBER_KEY } from './utils/react-find-dom-nodes';
|
||||||
@ -466,7 +466,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
isEmpty: () => false,
|
isEmpty: () => false,
|
||||||
};
|
};
|
||||||
viewProps._leaf = _leaf;
|
viewProps._leaf = _leaf;
|
||||||
return createElement(Comp, viewProps, children);
|
const View = getDeviceView(Comp, renderer.device, renderer.designMode);
|
||||||
|
return createElement(View, viewProps, children);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user