Skip to content

Commit

Permalink
Step 9. 处理分页
Browse files Browse the repository at this point in the history
  • Loading branch information
JobbyM committed Apr 26, 2017
1 parent 0fdc60d commit e1d9344
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/Users/Users.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import React from 'react';
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 deleteHandler(id){
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 @@ -55,6 +63,7 @@ function Users({ list: dataSource, loading, total, page: current }) {
total={total}
current={current}
pageSize={PAGE_SIZE}
onChange={pageChangeHandler}
/>
</div>
</div>
Expand Down

0 comments on commit e1d9344

Please sign in to comment.