Commit 156220ce authored by chencheng's avatar chencheng

8. Handle pagination

parent f81d36c6
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';
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',
......@@ -54,6 +62,7 @@ function Users({ list: dataSource, loading, total, page: current }) {
total={total}
current={current}
pageSize={PAGE_SIZE}
onChange={pageChangeHandler}
/>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment