{base ?
simple:false,
current:basePagination.current,
total:basePagination.total,
pageSizeOptions:['10','20','30','40','50'],
showSizeChanger:true,
pageSize:basePagination.pageSize,
showTotal: (count=basePagination.total)=>{return '共'+count+'条数据'},//onChange:ChangePage(),
onChange:(current,pageSize)=>{
onBaseClick(current,pageSize)
}
}}/> : }
调用的方法(分页点击的):
functiononBaseClick(current,pageSize){
dispatch({
type:"customerProtectLog/queryBase",
payload: {
current:current,
pageSize:pageSize
}
})
}
这个只是一个table的展示,其中这里面自己遇到的问题有:
1、pageSizeOptions不显示,这个可以看官网,数组是字符串数组,所以参数要传正确
2、还有就是方法onChange,这里遇到的问题是注释掉的代码,调用这个会持续请求后端接口 结果浏览器卡住。。。
3、注意自己调用参数的顺序,这都是坑
------------------------------------------------------------------------------------------
index部分代码
const listProps ={
list: list,//loading: loading.effects['customerProtectLog/queryBase'],
pagination:pagination,
location,
currentType:currentType,
onChange (page) {
。。。}return(
ddss
ddssddss } key="1" >
{var0}
{ dispatch({ type: 'customerProtectLog/exportFile', payload: { id: 1, name: "ddss" } }); }}> 导出
)
这里调用了list文件,代码如下:
return(
{...listProps}
dataSource={list}
className={classnames({ [styles.table]: true})}
bordered
scroll={{ x: 100}}
columns={getColumns()}//simple
rowKey={record => record.timestamp + '' + record.module + '' +generalKey()}//components={getBodyWrapper}
pagination={{
simple:false,
current: listProps.pagination.current,
total: listProps.pagination.total,
pageSizeOptions: ['10', '20', '30', '40', '50'],
showSizeChanger:true,
pageSize: listProps.pagination.pageSize,
showTotal: (count= listProps.pagination.total) =>{return '共' + count + '条数据'},
onChange: (page,currentType)=>{
},
}}/>
)
这里算是半个闭环,就是总结给自己看得;
其他关于pagination可以在官网上查到;