当前位置:   article > 正文

uniapp下拉刷新列表上拉加载更多方案_uniapp上拉加载更多

uniapp上拉加载更多
  1. data() {
  2. return {
  3. pageNum: 1,
  4. pageSize: 10,
  5. pageTotal: 0,
  6. listData:[],
  7. isFinish: false,
  8. };
  9. },
  10. onLoad(options){
  11. this.getList();
  12. },
  13. // 下拉刷新
  14. onPullDownRefresh(){
  15. this.pageNum = 0
  16. this.getList();
  17. },
  18. // 上拉加载
  19. onReachBottom(){
  20. this.pageNum++;
  21. this.getList();
  22. },
  23. methods: {
  24. async getList() {
  25. uni.showLoading({
  26. title: '加载中'
  27. });
  28. const params = {
  29. page: this.pageNum,
  30. pageSize: this.pageSize,
  31. }
  32. var res = await GetRecommendGoods(params);
  33. uni.hideLoading();
  34. if(res.code === "Success"){
  35. this.listData = res.data;
  36. this.pageTotal = res.totalCount;
  37. if(this.pageTotal < this.pageNum*this.pageSize){
  38. this.isFinish = true;
  39. }
  40. }
  41. },
  42. goDetail(item){
  43. uni.navigateTo({
  44. url: '/pages/client/shop/product?goodsId='+item.goodsId
  45. })
  46. },
  47. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/517203
推荐阅读
相关标签
  

闽ICP备14008679号