0.1.6 • Published 2 years ago
sg-low-code-react-renderer v0.1.6
React SG-Low-Code Renderer
用于渲染低代码平台页面的 React 组件库。
安装
你可以使用 npm 来安装这个包:
npm install sg-low-code-react-renderer
使用方法
单页面渲染
单页面渲染需要使用 ReactRenderer,它是一个 React 组件,用于渲染由低代码平台生成的页面。
import { ReactRenderer } from 'sg-low-code-react-renderer';
const App = () => {
// 你的页面和应用数据
const page = {...};
const app = {...};
return (
<ReactRenderer
page={page}
app={app}
loading={<YourLoadingComponent />}
/>
);
};
export default App;
其他能力
parseSchema
parseSchema 方法用于将低代码平台的 schema 转换成 React 组件。
import { parseSchema } from 'sg-low-code-react-renderer';
const schema = {...}; // 你的低代码schema
const packages = [...]; // 你的包数据
const { schema: parsedSchema, components } = parseSchema(schema, packages);
loadPlugins
loadPlugins 方法用于加载低代码平台的插件。
import { loadPlugins } from 'sg-low-code-react-renderer';
const plugins = [...]; // 你的插件数组
loadPlugins(plugins);
贡献
欢迎提出改进建议和贡献代码。