ASCII码 ASCII码

TP 商城分类页、列表页(七)

发布于:2022-05-23 17:07:06  栏目:技术文档

  1. public function goodslists(){
  2. $num = Db::table('shop_lists')->where('status',1)->where('cid',2)->count();
  3. $lists = Db::table('shop_lists')
  4. // ->field(['name','pic','pid','cid'])
  5. ->where('status',1)->where('cid',2)->page(1,5)->select()->toArray();
  6. $data = [
  7. 'code'=>200,
  8. 'message'=>'成功',
  9. 'data'=>[
  10. 'lists'=>$lists,
  11. //取页数
  12. 'total'=>ceil($num/5)
  13. ],
  14. ];
  15. echo json_encode($data);
  16. }
  17. //加载更多
  18. const loadmore = () => {
  19. console.log(mydata);
  20. mydata.page++;
  21. if (mydata.total >= mydata.page) {
  22. if(mydata.total == mydata.page){
  23. mydata.show = false;
  24. }
  25. goodslists().then((e) => {
  26. mydata.lists = mydata.lists.concat(e.data.data.lists);
  27. });
  28. }
  29. };
相关推荐
阅读 +