ant-design table 分页(tableProps)

From: https://www.cnblogs.com/crazycode2/p/9704382.html

1.布局

1

2

3

4

5

6

7

8

9

10

11

12

13

14

<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.逻辑

1

2

3

4

5

6

7

8

9

10

11

12

13

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)

  })

}

猜你喜欢

转载自blog.csdn.net/JoeBlackzqq/article/details/97781978
今日推荐