后端:(egg.js)
(current-1)*pageSize,pageSize
前端:(antd)
const pagination={ // 分页
simple: true,
current: this.state.current,
total: this.state.total,
onChange: this.changePage,
}
changePage = (page) => {
this.setState({
current: page,
}, () => {
const param = {
pageNum: this.state.current,
pageSize: 10,
}
this.state.isSearch==false?
this.fetch(param.pageNum,param.pageSize):this.handleSearch2()
})
}
<Table
bordered
columns={columns}
dataSource={data}
loading={loading}
onChange={this.handleTableChange}
pagination={pagination}
rowSelection={rowSelection}
onRow={record => ({
onClick: () => {
this.selectRow(record);
}
})}
/>