优化 users-motion

This commit is contained in:
felixpmg
2017-02-12 00:26:38 +08:00
parent d1ffb7e3e9
commit ceabac1a14
2 changed files with 11 additions and 10 deletions
+7 -5
View File
@@ -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 <div>
<Table className={styles.table} bordered scroll={{
x: 1200
}} columns={columns} dataSource={dataSource} loading={loading} onChange={(page) => {
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} />
</div>
}
}
+4 -5
View File
@@ -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({