Skip to content
maltose edited this page Nov 25, 2016 · 5 revisions

本协议由张泽和李雅堂共同敲定,如有错漏留issue

背景

目前发现每个业务都自有一套分页的写法,各不相同,带来接入成本。估借此统一。

名词说明

  • offset 位移,从0开始
  • limit 拉多少条数据,可以近似于一页有多少条数据
  • count 一共有多少条数据 (出于性能考虑,有些接口不会返回count)

--------offset----offset+limit---------------------->count

获取列表数据

请求 url 上带参数 xxxx?offset=0&limit=10

  • offset 可选,后台默认0
  • limit 可选,后台默认x,具体看应用。一般是10或者20把。

返回格式

{
    "code": 0,
    "data": [],
    "pagination": {
        "offset": 10,
        "limit": 10,
        "count": 90
    }
}

前端组件

Pagination

Clone this wiki locally