zoukankan      html  css  js  c++  java
  • 上拉加载 angular

    var obj = {page:1};//默认获取商品列表时传入参数,为第一页

    var flag = true;

     

    function order_list(options){

      var requestParams = {

      userId:sessionStorage.getItem("userId"),

      rowSize : 10,

      page : options.page,

    };

      var params = {

      url: configHttp+'order/list.do',

      method: 1,

      requestParams: requestParams,

      isShowLoading: false

    };

    sx.startRequest({

      params: params,

      success: function(res) {

      if(res && res.result_code == 1) {

      $scope.instances= res.object.instances;

      if($scope.instances.length == 0){

        $(".loading").html("暂无更多结果");

      }else if($scope.instances.length <10){

        $(".loading").html("暂无更多结果");

        for(var i in $scope.instances){

        $scope.data.push($scope.instances[i]);

      };

      }else{

        for(var i in $scope.instances){

        $scope.data.push($scope.instances[i]);

      };

      obj.page = obj.page+1;

      flag = true;

      $(".loading").html("加载更多");

    }

      $scope.$apply();

    }else{

      sixin.toast({message: "商品获取失败", type:"0"});

    };

    }

    })

    }

     

     

    //控制回到顶部按钮的显隐及加载更多

    $(window).on("scroll",function(){

      var windowBottom =$(window).scrollTop();

      var eleBottom = $(".orderList").offset().top+$(".orderList").height();

      remaining = windowBottom + $(window).height() + 50 - eleBottom;

      var shouldScroll = remaining>0?true:false;

      if(shouldScroll && flag){

        flag = false;

        order_list(obj);

      };

    });

  • 相关阅读:
    CSP2020 游记
    关于对拍
    联考day7
    CSP 模拟26
    动态规划
    JAVA单元测试的用法和要点(入门篇)
    乐观锁和悲观锁的区别
    并发基础篇(六):线程Thread类的start()方法和run()方法【转载】
    this和super差异
    Java中的static关键字解析
  • 原文地址:https://www.cnblogs.com/zyzhao/p/6041612.html
Copyright © 2011-2022 走看看