JS-分页插件

用于对数据分页显示

Questo script non dovrebbe essere installato direttamente. È una libreria per altri script da includere con la chiave // @require https://update.greasyfork.org/scripts/465550/1551954/JS-%E5%88%86%E9%A1%B5%E6%8F%92%E4%BB%B6.js

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Autore
WhiteSevs
Versione
0.0.1.20250312070906
Creato il
05/05/2023
Aggiornato il
12/03/2025
Dimensione
24,8 KB
Licenza
Non disponibile

数据分页导航

  • 基本使用
let dataPaging = new DataPaging({
  data: [1, 2, 3, 4, 5, 6, 7, 8, 9], // 数组,里面具体什么值无所谓,需要的是它的长度用来分页
  pageShowDataMaxCount: 5, // 每一页显示的数据条数,如上面的数组共有9个,每页显示5个,会有2页
  pageMaxStep: 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);
  • 动态修改上面的init的配置,如果当前数据长度改变的话可以使用它
dataPaging.changeConfig(details:Object);