Skip to content

Commit 90f5b78

Browse files
committed
🍰 DataTable fix inner pagination
1 parent 3ba7c62 commit 90f5b78

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/__mocks__/crud.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ export default ({fetchMock, delay, mock, toSuccess, toError}) => {
1111
const paramMap = body.paramMap;
1212
const deptName = paramMap.deptName;
1313

14+
if (deptName == 'abcd') {
15+
return toSuccess(mock({
16+
'currentPage': currentPage,
17+
'showCount': body.showCount,
18+
'totalResult': 0,
19+
'totalPage': 0,
20+
dataList: [],
21+
}), 400)
22+
}
23+
1424
return toSuccess(mock({
1525
'currentPage': currentPage,
1626
'showCount': body.showCount,

src/components/DataTable/DataTable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,14 @@ class DataTable extends Component {
250250
// 分页
251251
const paging = objectAssign(
252252
{
253+
total: dataItems.total,
254+
pageSize: dataItems.pageSize,
253255
showSizeChanger: true,
254256
showQuickJumper: true,
255257
showTotal: total => `共 ${total} 条`,
256258
onShowSizeChange: this.onShowSizeChange
257259
},
258-
dataItems.pageSize && { pageSize: dataItems.pageSize },
259260
dataItems.pageNum && { current: dataItems.pageNum },
260-
dataItems.total && { total: dataItems.total },
261261
pagination
262262
);
263263

0 commit comments

Comments
 (0)