ant-design table 分页

1.布局

<Table
  dataSource={this.state.tableDetailList}
  scroll={{ y: '200px' }}
  style={{tableLayout: 'fixed'}}
  pagination={{ pageSize: 12 }}
  columns={columns1}
  rowKey={record => record.restId}
  pagination={{  // 分页
    simple: true,
    current: this.state.current,
    total: this.state.total2,
    onChange: this.changePage,
  }}
/>

2.逻辑

changePage = (page) => {
  this.setState({
    current: page,
  }, () => {
    let param = JSON.parse(JSON.stringify(this.state.param))
    param = {
      ...param,
      pageNum: this.state.current,
      pageSize: 10,
    }
    this.getActivityRestDetailList(param)
  })
}

.

猜你喜欢

转载自www.cnblogs.com/crazycode2/p/9704382.html