DataView
中后台详情页解决方案,通过 schema 协议渲染页面
安装
npm i @xrenders/data-render --save
使用方式
函数组件
import React from 'react';
import DataView from '@xrenders/data-render';
const data = {
"creator": "清风徐来",
"relevanceCode": "421421",
"desc": "浙江省杭州市工专路",
"create-time": "2019-10-10",
"effective-date": "2019-10-10 ~ 2020-10-31",
"safety": {
"name": "Test demo 001",
"app": "中后台详情页",
"mode": "代码包",
"yum": "244444390482344744484889",
"fore": "23"
},
}
const schema = [
{
"widget": "FDescriptions",
"column": 3,
"items": [
{
"label": "创建人",
"dataKey": "creator"
},
{
"label": "关联单据",
"dataKey": "relevanceCode"
},
{
"label": "单据备注",
"dataKey": "desc"
},
{
"label": "创建时间",
"dataKey": "create-time"
},
{
"label": "生效日期",
"dataKey": "effective-date"
}
]
}
]
export default () => {
return (
<DataView schema={schema} data={data} />
);
}