mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-29 04:14:12 +00:00
优化 users-motion
This commit is contained in:
@@ -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
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user