@anderpang/pager
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Pager

Install

npm install @anderpang/pager

Constructor

export interface IPagerOptions {
    el: HTMLElement;
    maxPage: number;
    current?: number;
    size?: number;
    firstTrigger?: boolean;
    change?: (page: number) => void;
}

declare class Pager {
    constructor(options: IPagerOptions);
    go(page: number): void;
    setMaxPage(maxPage: number): void;
    update(): void;
}
export default Pager;

Usage

import

  import Pager from "@anderpang/pager";
  import "@anderpang/pager/Pager.css";

or

<link rel="stylesheet" href="@anderpang/pager/Pager.css" />
<script src="@anderpang/pager/dist/Pager.js"></script>

Example

  import Pager from "@anderpang/pager";
  import "@anderpang/pager/Pager.css";

   var pager=new Pager({
        el:document.querySelector(".pager")!,
        maxPage:300,
        // size:7,
        change(page:number){
            console.log("current page:",page)
        }
    });

Change Theme

 <style>
    .pager{
        color:#FFF;
        --text-invert:gold;
        --border-color:red;
        --bg-color:green;        
        --bg-hover-color:blue;
    }
 </style>

Readme

Keywords

Package Sidebar

Install

npm i @anderpang/pager

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

17.3 kB

Total Files

6

Last publish

Collaborators

  • anderpang