-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zhouyize
|
||
|
||
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> | ||
|
2 comments
on commit 156220c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个分页的方法好骚气
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
分页无法跳转啊,点击跳转之后url变成http://localhost:8000/userspage=2,onChangeHandle事件是触发了,但是url错了,请问怎么改啊?
这里PAGE_SIZE设置是3,但是页面显示是5,而且分页组件共有4个按钮1,2,3,4但是3,4都是no date???