angular.js中实现上拉下滑分页功能

xiaoxiao2021-02-28  23

//上拉下滑 $scope.scroller&&$scope.scroller.destroy(); $scope.scroller = $scrollPage.create("scrollWrap", function (noMoreFn) {//上拉加载函数 //$scope.count = $scope.count + 1; if ($scope.num > $scope.pageSize && $scope.num > $scope.Loadingcount * $scope.pageSize) { $scope.Loadingcount = $scope.Loadingcount + 1; params.currentIndex +=  params.pageSize; $remote.post("AppointmentMsgQuery.do", params, function (data) { //$scope.List1 = $scope.List.concat(data.List); $scope.List1 = data.List; setTimeout(function () { $scope.ResultList = $scope.ResultList.concat($scope.List1); $scope.$apply($scope.ResultList); $scope.scroller.refresh(); $scope.endFlag = data.recordNumber < (parseInt(params.currentIndex) + parseInt(params.pageSize)); noMoreFn($scope.endFlag); }, 100); }); } else { noMoreFn(true); }; }, function () {//下拉刷新函数 params.currentIndex = 0; $scope.Loadingcount = 0; $remote.post("AppointmentMsgQuery.do", params, function(data) { $scope.ResultList = data.List; setTimeout(function () { $scrollPage.enable(); $scope.scroller.refresh(); $scope.$apply($scope.ResultList); }, 100); }); }); };
转载请注明原文地址: https://www.6miu.com/read-2049995.html

最新回复(0)