分頁類,我放在 plugin/Paginate.js
* 目前開始的條數
*/
Paginate.prototype.first = function(){
var first = (this.page-1)*this.pagesize;
if(first>this.total){
return (this.maxpage-1)*this.pagesize;
}
* 當前頁最大的條數
*/
Paginate.prototype.last = function(){
var last = this.first() this.pagesize;
){
return this.total;
}
return last;
}
/**
* 下一頁
* @returns {*}
Paginate.prototype.prev = function(){
if(this.page return this.page-1;
}
/***/
Paginate.prototype.next = function(){
if(this.page >= this.maxpage){
🎜> return (parseInt(this.page) 1);
}
使用範例
複製程式碼
var q = req.query.q;