Page Builder SXP UI
React enterprise-class UI components
📦 安装
npm install pb-sxp-ui
yarn add pb-sxp-ui
🔨 使用
以 Next.js 框架为例子:
import { GetServerSideProps } from 'next';
import React, { FC } from 'react'
import Pagebuilder, { PageView } from 'pb-sxp-ui';
Pagebuilder.init({
tenantId: 'xxxxxxxxxx',
appId: 'xxxxxxxxx',
env: 'live'
});
interface IProps {
path: string;
data: any
}
const ContentPage: FC<IProps> = ({ data ,path}) => {
return (
<PageView data={data?.data} isSsr path={path}/>
)
}
export const getServerSideProps: GetServerSideProps<IProps> = async (
context
) => {
const path = context.query.path as string;
const result = await Pagebuilder.getDetail(path)
return {
props: {
path,
data: result.data
},
};
};
export default ContentPage;
⌨️ 本地调试
运行开发环境
$ npm install
$ npm run start
生成本地开发全局链接
npm link
yarn link
在使用该包的项目中安装调试
npm link pb-sxp-ui
yarn link pb-sxp-ui
👾 发布
打包线上安装包
npm run package
yarn package
发布 npm
$ npm version patch|minor|major
$ npm publish
$ npm run pub patch|minor|major|xx.xx.xx