{"id":13781647,"url":"https://github.com/thinkjs/think-pagination","last_synced_at":"2025-04-06T17:31:40.493Z","repository":{"id":65374765,"uuid":"49395874","full_name":"thinkjs/think-pagination","owner":"thinkjs","description":"Pagination for ThinkJS 3 \u0026 2","archived":false,"fork":false,"pushed_at":"2021-06-30T23:36:23.000Z","size":12,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-11T12:44:21.054Z","etag":null,"topics":["pagination","thinkjs"],"latest_commit_sha":null,"homepage":"https://thinkjs.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinkjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-11T02:05:08.000Z","updated_at":"2021-06-30T23:36:26.000Z","dependencies_parsed_at":"2023-01-20T01:25:24.295Z","dependency_job_id":null,"html_url":"https://github.com/thinkjs/think-pagination","commit_stats":null,"previous_names":["thinkjs-team/think-pagination","thinkjs-team/think-pagenation"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-pagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-pagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-pagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-pagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkjs","download_url":"https://codeload.github.com/thinkjs/think-pagination/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247522345,"owners_count":20952528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pagination","thinkjs"],"created_at":"2024-08-03T18:01:27.945Z","updated_at":"2025-04-06T17:31:40.140Z","avatar_url":"https://github.com/thinkjs.png","language":"JavaScript","readme":"# think-pagination\n\npagination for ThinkJS 3, if you want to use in ThinkJS 2.x, please view [README_v2](./README_v2.md)\n\n## install\n\n```sh\nnpm install think-pagination\n```\n\n## how to use\n\n### controller\n\n```js\nconst pagination = require('think-pagination');\n\nmodule.exports = class extends think.Controller {\n  async indexAction() {\n    const data = await this.model('user').page(this.get('page')).countSelect();\n    const html = pagination(data, this.ctx, {});\n    this.assign('pagination', html);\n  }\n}\n```\n\n### view\n\n#### ejs\n\n```html\n{%-pagination%}\n```\n\n#### nunjucks\n\n```html\n{{pagination | safe}}\n```\n\n## API\n\n### pagination(pagerData, ctx, options)\n\n* `pagerData`  get from by model.countSelect\n* `ctx` ctx object\n* `options` options\n\n`options`:\n\n```js\n{\n  desc: false, //show description\n  pageNum: 2, \n  url: '', //page url, when not set, it will auto generated\n  class: '', //pagenation extra class\n  text: {\n    next: 'Next',\n    prev: 'Prev',\n    total: 'count: __COUNT__ , pages: __PAGE__'\n  }\n}\n```\n","funding_links":[],"categories":["Others"],"sub_categories":["websocket"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-pagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkjs%2Fthink-pagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-pagination/lists"}