function fenyefun(count) {
layui.use('laypage', function() {
var laypage = layui.laypage;
laypage.render({
elem: 'fenye', //id
count: count,//商品数量
limit: 10,
layout:['page'],
jump: function(obj, first) {
prodata.page = obj.curr++;
$.ajax({
url: phptitle + "Product/index",
dataType: 'json',
type: 'post',
data: prodata,
success: function(res) {
if (checkcode(res)) {
vm.list = res.data.list;
}
},
error: function() {
layer.msg('获取数据失败', {
icon: 2
});
}
});
}
});
});
}
本文介绍了一种利用layui框架的laypage模块实现分页功能的方法。通过具体代码示例,详细展示了如何设置分页元素ID、商品数量、每页显示条数等参数,并在页面跳转时通过AJAX请求动态加载数据。
3185

被折叠的 条评论
为什么被折叠?



