Files
wechat-minigame/js/content/shared/pagination.js
manpengan faeb453a64 nav: 三级导航分页结构 + 中国地区索引
- 02-game-design 地图结构重写:洲→国家→城市,3x3棋盘分页
- 中国 40 城按 8 地区分组(华北/东北/华东/华中/华南/西南/西北/港澳)
- 导航索引数据:continents/index + asia + regions/china + pagination工具

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:20:58 +08:00

15 lines
383 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 通用分页工具 — 将数组按 pageSize 分页
// 默认 pageSize = 93x3 棋盘)
export function paginate(items, pageSize = 9) {
const pages = []
for (let i = 0; i < items.length; i += pageSize) {
pages.push(items.slice(i, i + pageSize))
}
return pages
}
export function getPageCount(totalItems, pageSize = 9) {
return Math.ceil(totalItems / pageSize)
}