Code Monkey home page Code Monkey logo

node-pagination's Introduction

##Pagination Node.js Library 基于Node.js版的JavaScript分页组件

使用方法:

安装:

$ npm install -g node-pagination

使用:

var pagination = require("node-pagination");

total      : 总数
page       : 当前页
pagesize   : 每页包含的内容
offset     : 偏移量(例如1 2 3 4 5 6,点击6时,产生4 5 6 7 8 9,而非 7 8 9 10 11 12)
length     : 例如 上一页 2 3 4 5 6 下一页,则步长为5

pv = pagination.build( total, page, pagesize, offset, length );

计算后结果:

pv.total      //总数
pv.page       //当前页
pv.pagesize   //每页的内容数
pv.lastpage   //最后一页
pv.loopcount  //共计多少分页
pv.previous   //前一页
pv.next       //后一页
pv.isprevious //是否显示前一页
pv.isnext     //是否显示后一页
pv.begin      //开始
pv.end        //结束
pv.length     //原始的步长(即传入的参数,也是begin -> end时的步长)
pv.step       //步长(真实的步长)
pv.isforward  //是否可以前进,指">>"
pv.isback     //是否可以后退,指"<<"
pv.forward    //前进到第几页
pv.back       //后退到第几页
pv.offset     //偏移量

测试:

..\node_modules\node-pagination\test\node test.js

其他版本的分页组件:

JavaScript版:https://github.com/kenshin/js-pagination
ActionScript版:https://github.com/kenshin/as-pagination

更新日志:

version 1.0.0 [2012-05-05]

  • 基于Node.js
  • 支持复杂分页

联系方式:

版权和许可:

Copyright 2012 k-zone.cn
Licensed under MIT or GPL Version 2 licenses

node-pagination's People

Contributors

kenshin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

bsfan gonenative

node-pagination's Issues

How to turn off the logs

This is the log

pv.page = 2
pv.total = 6
pv.loopcount = 2
pv.pagesize = 2
pv.lastpage = 3
pv.begin = 1
pv.end = 4
pv.previous = 1
pv.next = 3
pv.isprevious = true
pv.isnext = true
pv.isforward = false
pv.isback = false
pv.forward = 4
pv.back = 1
pv.offset = undefined
pv.length = undefined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.