点击按钮再次执行flow.load要怎样实现

提问 未结
1 398
Fengiy
Fengiy VIP4 2017-12-29
悬赏:20飞吻
版本:layui 浏览器:
默认reorder = 1初始化数据,点击按钮给reorder赋值,怎样重新加载数据执行flow.load?
本人菜鸟,请大神帮忙看看
感激感谢

layui.use(['form', 'flow'], function(){	
var $ = layui.jquery; //不用额外加载jQuery,flow模块本身是有依赖jQuery的,直接用即可。
var form = layui.form;
var flow = layui.flow;
var reorder = 1;
init();

$("#Sort-Sort li").each(function(){
$(this).click(function(){
$(this).addClass("onli");
$(this).siblings().removeClass("onli");
if($(this).attr("class")=="onli"){
$('.Sort-eject').removeClass('grade-w-roll');
var reorder=$(this).attr("name");
}
console.log(reorder);
init(reorder);
});
});

function init(reorder){
flow.load({
elem: '#LAY_box',
done: function(page, next){
setTimeout(function(){
var lis = [];
$.post('__CONTROLLER__/index_json/page/'+page,{infos:infos,reorder:reorder},function(res){
layui.each(res.data, function(index,item){
var str = "<div class='imgbox f-l'><a href='__MODULE__/Product/product_show/proid/"+item.proid+"'>";
var str = str + "<div class='pro-pic'><img src='http://img.hcyh618.com/Upload/cpimg/"+item.proimg+"' alt=''></div>";
var str = str + "<div class='pro-text'>";
if(item.ishit==1 && item.cuxiao==0){
var str = str + "<div class='textbt'>"+item.proname+"</div><cite class='price'>"+item.memberprice+"</cite><cite class='c-999'>积分</cite>";
}else{
var str = str + "<div class='textbt'>"+item.proname+"</div><cite class='price'>"+item.rebates+"</cite><cite class='c-999'>积分</cite>";
}
var str = str + "</div>";
var str = str + "</a></div>";

lis.push(str);
});
next(lis.join(''), page < res.pages);
});
}, 500);
}
});
}
});
回帖
本帖已设置禁止回复