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 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-pagination-template

v1.0.6

Published

nodejs应用中通用html分页模版生成器

Downloads

22

Readme

node-pagination-template

项目介绍

  • nodejs应用中通用html分页模版生成器

安装

  • (c)npm install node-pagination-template -D

使用

    // *** 001
    
    const paginationTemplate = require('node-pagination-template');
    let text = paginationTemplate({
        dataTotal: 20,                 // 数据总条数
        perPage: 1,                    // 每页显示条数
        currentPage: 6,                // 当前页码
        linkUrl: 'http://127.0.0.1/user/list/{page}?page={page}', // url {page} 将会被替换成实际页码
    });
    
    // complete
    <ul class="pagination">
        <li><a href="http://127.0.0.1/user/list/5?page=5">&lt;</a></li>
        <li><a href="http://127.0.0.1/user/list/1?page=1">1</a></li>
        <li><a href="http://127.0.0.1/user/list/2?page=2">2</a></li>
        <li><a href="http://127.0.0.1/user/list/3?page=3">3</a></li>
        <li><a href="http://127.0.0.1/user/list/4?page=4">4</a></li>
        <li><a href="http://127.0.0.1/user/list/5?page=5">5</a></li>
        <li class="active"><span>6</span></li>
        <li><a href="http://127.0.0.1/user/list/7?page=7">7</a></li>
        <li><a href="http://127.0.0.1/user/list/8?page=8">8</a></li>
        <li class="disabled"><span>...</span></li>
        <li><a href="http://127.0.0.1/user/list/19?page=19">19</a></li>
        <li><a href="http://127.0.0.1/user/list/20?page=20">20</a></li>
        <li><a href="http://127.0.0.1/user/list/7?page=7">&gt;</a></li>
    </ul>
    // add bootstrap css
  • 如下

图片介绍

    // *** 002
    
    let text2 = paginationTemplate({
        dataTotal: 20,               // 数据总条数
        perPage: 1,                  // 每页显示条数
        currentPage: 10,             // 当前页码
        linkUrl: '/user/list/{page}?page={page}',  // url {page} 将会被替换成实际页码
        linkQuery: {                 // 可选 | 在地址后面拼接 query string
            username: 'long',
            page2: '{page}'
        },
        btnText: {                   // 可选 | 更改分页按钮文本
            prev: '上一页',
            next: '下一页',
            ellipsis: '...',
            link: '第{page}页'
        },
    });
    
    // complete
    <ul class="pagination">
        <li><a href="/user/list/9?page=9&page2=9&username=long">上一页</a></li>
        <li><a href="/user/list/1?page=1&page2=1&username=long">第1页</a></li>
        <li><a href="/user/list/2?page=2&page2=2&username=long">第2页</a></li>
        <li class="disabled"><span>...</span></li>
        <li><a href="/user/list/8?page=8&page2=8&username=long">第8页</a></li>
        <li><a href="/user/list/9?page=9&page2=9&username=long">第9页</a></li>
        <li class="active"><span>第10页</span></li>
        <li><a href="/user/list/11?page=11&page2=11&username=long">第11页</a></li>
        <li><a href="/user/list/12?page=12&page2=12&username=long">第12页</a></li>
        <li class="disabled"><span>...</span></li>
        <li><a href="/user/list/19?page=19&page2=19&username=long">第19页</a></li>
        <li><a href="/user/list/20?page=20&page2=20&username=long">第20页</a></li>
        <li><a href="/user/list/11?page=11&page2=11&username=long">下一页</a></li>
    </ul>
    // add bootstrap css
  • 如下

图片介绍