react pagination

鲁靖
2023-12-01
class AppPagination extends React.Component {
    handleChange(pageNum) {
        this.props.handleChangePage(pageNum);
    }
    showTotalPage() {
        return `共 ${this.props.total} 条`;
    }
    render() {
        return (
            <div>
                {this.props.total > 0 ? <Pagination 
                    defaultCurrent={1}
                    showQuickJumper={true}
                    total={this.props.total}
                    pageSize={this.props.pageSize}
                    showTotal={this.showTotalPage.bind(this)}
                    onChange={this.handleChange.bind(this)}
                /> : null}
            </div>
        )
    }
    
}
export default AppPagination;

使用:

<AppPagination
   total={this.state.totalElements}
   pageSize={this.state.size}
   handleChangePage={(pageNum) => this.handleChangePage(pageNum)}
   />
   handleChangePage(pageNum){
    initdata(pageNum)
   }

 

转载于:https://www.cnblogs.com/Nyan-Workflow-FC/p/8798619.html

 类似资料:

相关阅读

相关文章

相关问答