New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jdcfe/data-logic

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jdcfe/data-logic

跨端 UI 组件数据与逻辑

  • 0.1.0-pre.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
7
Weekly downloads
 
Created
Source

分页器组件

实例化

// 构造新的分页器:总页数,当前页,每页多数据条数
new Pagination(total, current, pageSize)

实例方法

.build(buttons: number): PageNav[]

buttons 表示可视区分页按钮的个数,一般为奇数个(保证两端对称),3、5 等

export interface PageCtrl {
    type: 'prev' | 'next'
    disabled: boolean
}
export interface PageItem {
    type: 'item'
    active: boolean
    page: number
}
export interface PageSep {
    type: 'ellipsis'
    dir: 'head' | 'tail'
}

type PageNav = PageCtrl | PageItem | PageSep

返回结果示例

[
  { type: "prev", disabled: true },
  { type: "item", active: true, page: 1 },
  { type: "item", active: false, page: 2 },
  { type: "item", active: false, page: 3 },
  { type: "next", disabled: false }
]

.print(): string

打印图形化结果,方便调试

let paginate = new Pagination(10, 1, 1)
paginate.print() // '|<|*1*|2|3|4|.|10|>|'

解释:

 ▾prev            ▾next
|<|*1*|2|3|4|.|10|>|
    ▴current ▴ellipsis

详细测试用例

Pagination.test.ts

FAQs

Package last updated on 29 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc