分页加载数据(每次10条内容)的简单计算
代码逻辑如下:
// 计算当前页的个数
if (allCount - page * 10 >= 0){
currentCount = 10;
}else{
currentCount = allCount - (page - 1) * 10;
}
allCount是总数,page是当前的页码,currentCount就是当前要显示的数目。
对技术有一种敬畏,因为它可以改变世界,最重要的是我们可以一点一点得到它
代码逻辑如下:
// 计算当前页的个数
if (allCount - page * 10 >= 0){
currentCount = 10;
}else{
currentCount = allCount - (page - 1) * 10;
}
allCount是总数,page是当前的页码,currentCount就是当前要显示的数目。