$scope.allNum = $scope.listData.length;$scope.allPage = Math.ceil($scope.allNum / 10);console.log($scope.listData); //分页$scope.defaultPage = 1;$scope.nowArr = [];for(var i=0; i<($scope.allNum < 10?$scope.allNum:10);i++){ $scope.nowArr.push($scope.listData[i]);} //下一页$scope.pageDown = function(){ $scope.nowArr = []; if($scope.defaultPage<$scope.allPage){ $scope.defaultPage++; } for(var i=($scope.defaultPage-1)*10;i<($scope.defaultPage*10);i++){ if(i<=$scope.allNum-1){ $scope.nowArr.push($scope.listData[i]); } }};//上一页$scope.pageUp = function(){ $scope.nowArr = []; if($scope.defaultPage>1){ $scope.defaultPage--; } for(var i=($scope.defaultPage-1)*10;i<($scope.defaultPage*10);i++){ if(i<=$scope.allNum-1){ $scope.nowArr.push($scope.listData[i]); } }};//go$scope.pageGo = function(pageNow){ $scope.nowArr = []; if(pageNow>=1&&pageNow<=$scope.allPage){ $scope.defaultPage = pageNow; } for(var i=($scope.defaultPage-1)*10;i<($scope.defaultPage*10);i++){ if(i<=$scope.allNum-1){ $scope.nowArr.push($scope.listData[i]); } }};
时间: 2024-10-05 08:56:37