@aligov/miniapp-portal-render
DEMO
import { createElement, useState, useEffect } from 'rax';
import MyComponent from '@aligov/miniapp-portal-render';
import { isWeb } from 'universal-env';
import { schema as mockSchema } from '../mock/data';
function App(){
const [schema, setSchema] = useState(null);
useEffect(() => {
// 自定义样式
document.body.style.margin = 0;
document.body.style.padding = 0;
document.body.style.background = '#f7f7f7';
setTimeout(() => {
setSchema(mockSchema);
}, 200);
}, []);
const gotoPage = (params) => {
if (!params || !params.url) {
return;
}
if (isWeb) {
window.location.href = params.url;
}
};
const eventsMap = { gotoPage };
const onCallEvents = (type, data, cb) => {
if (type && typeof eventsMap[type] === 'function') {
eventsMap[type](data, cb);
}
};
return (
<MyComponent
schema={schema}
onCallEvents={onCallEvents}
/>
);
}
export default App;
basic usage
rax-example
Install
$ npm install rax-example --save
Usage
import RaxExample from 'rax-example';
API
Props
name | type | default | describe |
---|---|---|---|
name | String | '' | describe |
Function
name | param | return | describe |
---|---|---|---|
name | Object | / | describe |
Example
import { createElement, render } from 'rax';
import DriverUniversal from 'driver-universal';
import RaxExample from 'rax-example';
render(<RaxExample />, document.body, { driver: DriverUniversal });
涉及模块
- @aligov/block-search-header——搜索条
- @aligov/miniapp-user-box——用户区块
- @aligov/block-news-swiper——新闻模块
- @aligov/block-service-hotlist——推荐服务模块
- @aligov/block-certificate-card-swiper——我的证件模块
- @aligov/block-csj-service-swiper——长三角服务模块
- @aligov/block-service-market——服务市场模块
- @aligov/block-service-zone——专区服务模块
- @aligov/block-service-subject——服务主题模块