$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]);
}
}
};
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步