Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kne/info-page",
"version": "0.1.24",
"version": "0.1.25",
"description": "一般用在复杂的详情展示页面,InfoPage提供了一个标准的展示信息的格式",
"syntax": {
"esmodules": true
Expand Down
9 changes: 5 additions & 4 deletions src/TableView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const TableView = p => {

const header = <Header {...props} defaultSpan={defaultSpan} colsSize={colsSize} setColsSize={setColsSize} />;

const body =
dataSource.length > 0 ? (
const renderBody = dataSource => {
return dataSource && dataSource.length > 0 ? (
dataSource.map(item => {
const id = get(item, typeof rowKey === 'function' ? rowKey(item) : rowKey);
const isChecked = rowSelection?.selectedRowKeys && rowSelection.selectedRowKeys.indexOf(id) > -1;
Expand Down Expand Up @@ -166,13 +166,14 @@ const TableView = p => {
) : (
<div className={style['empty']}>{empty}</div>
);
};
if (typeof render === 'function') {
return render({ ...others, header, body });
return render({ ...others, header, renderBody });
}
return (
<div {...others} className={classnames(style['table'], 'info-page-table', className)}>
{header}
<div className={classnames('info-page-table-body')}>{body}</div>
<div className={classnames('info-page-table-body')}>{renderBody(dataSource)}</div>
</div>
);
};
Expand Down