%9

var res = response.data;
var list = res.data;
var index=0;
let allData = [];

for(var i = 0; i < list.length; i++) {
    if((i !== 0 && (i + 1) % 9 === 0 ) || i==list.length-1) {
        let arr = []
        for(var j=index; j<i+1;j++){
            arr.push(list[j])
        }
        index = i+1;
        allData.push(arr);
    }
}

//let arr;
/*for(var i = 0; i < list.length; i++) {
    if(i==0 || i%9==0){
        arr = []
    }
    arr.push(list[i])
    if((i + 1) % 9 == 0 || i==list.length-1){
        allData.push(arr);
    }
}*/

You may also like...

发表评论