数组分页
javascript中数组的简单分页
安装
npm install paginate - array
用法
const paginate = require ( "paginate-array" ) ;
const collection = [ ... ] ;
const paginateCollection = paginate ( collection [ , pageNumber , numItemsPerPage ] ) ;
console . log ( paginateCollection )
{
currentPage : 1 ,
perPage : 10 ,
total : 20 ,
totalPages : 2 ,
data : [ ... ]
}
1