jjb-lc-designable
Version:
基于alibaba-designable源码二次封装的表单设计器。
15 lines • 868 B
JavaScript
import React from 'react';
import { ScreenType } from 'jjb-lc-designable/core';
import { requestIdle } from 'jjb-lc-designable/shared';
import { observer } from 'jjb-lc-formily/reactive-react';
import { useScreen } from '../hooks';
import { MobileSimulator, PCSimulator, ResponsiveSimulator } from '../simulators';
export const Simulator = observer(props => {
const screen = useScreen();
if (screen.type === ScreenType.PC) return /*#__PURE__*/React.createElement(PCSimulator, props, props.children);
if (screen.type === ScreenType.Mobile) return /*#__PURE__*/React.createElement(MobileSimulator, props, props.children);
if (screen.type === ScreenType.Responsive) return /*#__PURE__*/React.createElement(ResponsiveSimulator, props, props.children);
return /*#__PURE__*/React.createElement(PCSimulator, props, props.children);
}, {
scheduler: requestIdle
});