我的项目有问题。我有一个页面有多个分页。什么时候在页面中显示数据,则分页数据无法正确显示。例如,一个有两个块public
,private
,当我显示public
块时,则显示来自私有块的数据。另外,如果分页中没有数据,则分页不会停止。
这是我的控制器代码
public function profile() {
$user = Auth::user();
$latestpublics = Article::where([['user_id', $user->id], ['private', 0]])->orderBy('created_at', 'DESC')->with('votes')->paginate(5);
$latestprivates = Article::where([['user_id', $user->id], ['private', 1]])->orderBy('created_at', 'DESC')->with('votes')->paginate(5);
$publics = Article::where([['user_id', $user->id], ['status', 0], ['private', 1]])->orderBy('created_at', 'DESC')->with('votes')->paginate(5);
$privates = Article::where([['user_id', $user->id], ['status', 0], ['private', 0]])->orderBy('created_at', 'DESC')->with('votes')->paginate(5);
return view('frontend.profile', compact('user', 'latestpublics', 'latestprivates', 'publics', 'privates'));
}
我的Js是
jQuery('.tab-pane-infinitescroll ul.pagination').hide();
jQuery(function() {
jQuery('.tab-pane-infinitescroll .scroll').jscroll({
autoTrigger: true,
nextSelector: '.pagination li + li a',
contentSelector: '.tab-pane-infinitescroll div.scroll',
callback: function() {
jQuery('.tab-pane-infinitescroll ul.pagination').hide();
jQuery('.circle').circleProgress({
animation: false,
fill: {color: "#f76e24"},
size: 37,
emptyFill: '#d3d3d3',
thickness: 2
});
}
});
jQuery('.tab-pane-infinitescroll .scroll').removeClass('jscroll_added');
jQuery('.tab-pane-infinitescroll .scroll').addClass('jscroll_added');
});
我猜测问题出在类上,无论我在不同的块上使用diffr = erent id还是结果相同。在此先感谢