Skip to content

Commit

Permalink
8. Handle pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Feb 22, 2018
1 parent f81d36c commit 156220c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/pages/users/components/Users.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import { connect } from 'dva';
import { Table, Pagination, Popconfirm } from 'antd';
import { routerRedux } from 'dva/router';
import styles from './Users.css';
import { PAGE_SIZE } from '../constants';

This comment has been minimized.

Copy link
@eruca

eruca Sep 9, 2018

这里PAGE_SIZE设置是3,但是页面显示是5,而且分页组件共有4个按钮1,2,3,4但是3,4都是no date???

This comment has been minimized.

Copy link
@thunderstreak

thunderstreak Jan 8, 2019

PAGE_SIZE 是指每页显示的条数,按照总计条数 10/3 余 1 也就是4页

This comment has been minimized.

Copy link
@zhouyize

zhouyize Feb 28, 2019

这里PAGE_SIZE设置是3,但是页面显示是5,而且分页组件共有4个按钮1,2,3,4但是3,4都是no date???

你的services里的fetch有个limit参数写死成5了,你应该没有改成${PAGE_SIZE}


function Users({ list: dataSource, loading, total, page: current }) {
function Users({ dispatch, list: dataSource, loading, total, page: current }) {
function deleteHandler(id) {
console.warn(`TODO: ${id}`);
}

function pageChangeHandler(page) {
dispatch(routerRedux.push({
pathname: '/users',
query: { page },
}));
}

const columns = [
{
title: 'Name',
Expand Down Expand Up @@ -54,6 +62,7 @@ function Users({ list: dataSource, loading, total, page: current }) {
total={total}
current={current}
pageSize={PAGE_SIZE}
onChange={pageChangeHandler}
/>
</div>
</div>
Expand Down

2 comments on commit 156220c

@baixiaoyu2997
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个分页的方法好骚气

@nokkNoK
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.