JavaScript版
var pagecount = parseInt((options.total + options.pagesize - 1) / options.pagesize);//页数
//页码,每页数量,待分数组 function pagination(pageNo, pageSize, array) { var offset = (pageNo - 1) * pageSize; return (offset + pageSize >= array.length) ? array.slice(offset, array.length) : array.slice(offset, offset + pageSize); }