JS-分页插件

用于对数据分页显示

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/465550/1551954/JS-%E5%88%86%E9%A1%B5%E6%8F%92%E4%BB%B6.js


Ask a question, post a review, or report the script.
Author
WhiteSevs
Version
0.0.1.20250312070906
Created
2023-05-05
Updated
2025-03-12
Size
24.8 KB
License
N/A

数据分页导航

let dataPaging = new DataPaging({
data: [1, 2, 3, 4, 5, 6, 7, 8, 9], // 数组,里面具体什么值无所谓,需要的是它的长度用来分页
pageCount: 5, // 每一页显示的数据条数,如上面的数组共有9个,每页显示5个,会有2页
pageStep: 3, // 显示出来的按钮数量
currentPage: 1, // 当前处于的第几个页码
pageChangeCallBack:function(page){ // 当页码切换时发生的回调
console.log(page);
},
/* 上一页按钮 */
prevBtn: {
enable: true /* 是否启用 */,
callBack: function () {} /* 点击事件回调 */,
},
/* 下一页按钮 */
nextBtn: {
enable: true /* 是否启用 */,
callBack: function () {},
},
/* 第一页按钮 */
firstBtn: {
enable: true /* 是否启用 */,
callBack: function () {},
},
/* 最后一页按钮 */
lastBtn: {
enable: true /* 是否启用 */,
callBack: function () {},
},
});
dataPaging.append(element:HTMLElement);
dataPaging.changeConfig(details:Object);