diff --git a/src/components/users/list.js b/src/components/users/list.js index 23e4247..2d64112 100644 --- a/src/components/users/list.js +++ b/src/components/users/list.js @@ -45,6 +45,7 @@ class list extends React.Component { } getBodyWrapper = (body) => { + // 切换分页去除动画; if (this.currentPage !== this.newPage) { this.currentPage = this.newPage return body @@ -60,6 +61,11 @@ class list extends React.Component { e.target.style.height = 'auto' } + async pageChange(pagination) { + await this.props.onPageChange(pagination) + this.newPage = pagination.current + } + render () { const { loading, @@ -133,11 +139,7 @@ class list extends React.Component { return
{ - onPageChange(page, () => { - self.newPage = page.current - }) - }} pagination={pagination} simple rowKey={record => record.id} getBodyWrapper={this.getBodyWrapper} /> + }} columns={columns} dataSource={dataSource} loading={loading} onChange={::this.pageChange} pagination={pagination} simple rowKey={record => record.id} getBodyWrapper={this.getBodyWrapper} /> } } diff --git a/src/routes/users.js b/src/routes/users.js index 92d9e4f..2832ddf 100644 --- a/src/routes/users.js +++ b/src/routes/users.js @@ -30,17 +30,16 @@ function Users ({ location, dispatch, users }) { dataSource: list, loading, pagination: pagination, - async onPageChange (page, callback) { - const query = location.query - await dispatch(routerRedux.push({ - pathname: '/users', + onPageChange (page) { + const { query, pathname } = location + dispatch(routerRedux.push({ + pathname: pathname, query: { ...query, page: page.current, pageSize: page.pageSize } })) - await callback && callback() }, onDeleteItem (id) { dispatch({