npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

paging-sm

v2.1.0

Published

分页组件

Readme

分页组件使用说明

依赖 jQuery 1.9.1+

参与开发请注意js压缩使用uglifyjs,建议全局安装uglifyjs

npm install uglify-js -g

引入方式

ES6

import Paging from 'paging-sm';

AMD

require(['paging-sm'], function(Paging){

  //cookie方法操作

})

调用方式

//创建回调函数
function buildHtml(data) {
  console.log(data);
}

//创建分页实例
var chinasoPage = new Paging({
  //列表渲染完成后的回调函数名,必填
  callback: null,

  //总页数,默认为10页
  totalPage: 10,

  //接口地址,必填
  url: '',

  //请求参数
  params: '',

  //返回数据中总页数字段名或者计算总页数函数,若不传,则默认加载最多10页数据
  jsonTotalPage: '',

  //当前页请求参数名,默认为pageNo
  pageIndexName: 'pageNo',

  //第一页数据从0开始还是从1开始,默认从0开始
  pageStart: 0,

  //数据请求类型
  datatype: 'json',

  //jsonp回调参数名
  jsonpName: 'callback',

  //jsonp回调参数值,即响应回来的jsonp函数名,不传的话默认为jquery自动生成
  jsonpCallbackName: '',

  //分页页码放置的外层容器ID
  paginationID: 'pagination',

  //数据渲染成功后是否跳转到页面顶部
  isGoTop: true,

  // 是否显示跳转页码
  isJumpPage: false

 });

chinasoPage.init();

参数调用说明

参数名 | 参数调用例子 --- | --- jsonTotalPage | 可以是字符串类型,如:totalPage 或者函数类型

  • | jsonTotalPage: function(data){
  • | return Math.floor(data.totalCount / data.pageSize);
  • | }

更新参数

//params为&符号连接的字符串,如:&pageno=1&channel=XXX
chinasoPage.updateParams(params);