What is the method for passing parameters in layui pagination?

When using the layui pagination component, you can set the number of data entries per page and the current page number by passing in the limit and curr parameters.

For example,

// 初始化分页组件
layui.use('laypage', function(){
    var laypage = layui.laypage;
        elem: 'demo', // 分页容器的id
        count: 100, // 数据总数
        limit: 10, // 每页显示的条数
        curr: 1, // 当前页数
        jump: function(obj, first){
            // obj包含了当前分页的所有参数,例如obj.curr是当前页数,obj.limit是每页显示的条数
            // 通过ajax请求获取对应页数的数据

In the jump callback function, you can use obj.curr and obj.limit to retrieve the current page number and number of data items displayed per page, and then make an ajax request to fetch the data for the corresponding page.

Leave a Reply 0

Your email address will not be published. Required fields are marked *