Skip to content

Commit 84111a4

Browse files
committed
[OSS101] Complete task 5: Change the method of loading new data from scrolling down and clicking to flipping pages X-lab2017#115
1 parent e6c9b42 commit 84111a4

File tree

3 files changed

+3
-39
lines changed

3 files changed

+3
-39
lines changed

src/components/table.js

+3-35
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,6 @@ function MyTable(props) {
352352
});
353353
}, [props]);
354354

355-
const expandData = () => {
356-
setState({
357-
...state,
358-
showSize: state.showSize + 25,
359-
});
360-
};
361355
const updateDate = (newstate) => {
362356
console.log('table update', newstate);
363357
// 先获取原先的表格属性
@@ -520,39 +514,13 @@ function MyTable(props) {
520514
// scroll={{ x: 1500, y: 300 }}
521515
columns={columns}
522516
rowKey={(record) => record.rank}
523-
dataSource={data.slice(0, Math.min(showSize, data.length))}
524-
pagination={false}
517+
dataSource={data}
518+
pagination={{ position: ['bottomRight'], pageSize: showSize }}
525519
loading={loading}
526520
scroll={{ x: 'max-content' }}
527521
/>
528522
<Row style={{ marginTop: '10px' }}>
529-
<Col span={12}>
530-
<Row justify="start">
531-
<Col>
532-
{showSize < data.length ? (
533-
<a
534-
style={{
535-
color: '#FFCC19',
536-
fontSize: '18px',
537-
}}
538-
onClick={expandData}
539-
>
540-
{t('showMore') + '>>'}
541-
</a>
542-
) : (
543-
<span
544-
style={{
545-
color: 'gray',
546-
fontSize: '18px',
547-
}}
548-
>
549-
{t('noMore')}
550-
</span>
551-
)}
552-
</Col>
553-
</Row>
554-
</Col>
555-
<Col span={12}>
523+
<Col span={24}>
556524
<Row justify="end">
557525
<Col>
558526
<QAmiss />

src/locales/en.json

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
"activity": "Activity",
2626
"influence": "OpenRank",
2727
"details": "Details",
28-
"showMore": "show more",
29-
"noMore": "no more",
3028
"issue_comments": "Issue Comments",
3129
"open_issues": "Open Issues",
3230
"open_pulls": "Open PRs",

src/locales/zh.json

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
"activity": "活跃度",
2626
"influence": "OpenRank",
2727
"details": "详情",
28-
"showMore": "展示更多",
29-
"noMore": "没有更多啦",
3028
"issue_comments": "Issue 评论",
3129
"open_issues": "创建 Issue",
3230
"open_pulls": "创建 PR",

0 commit comments

Comments
 (0)