代码实现:
const transSliceImg = (imgs, num) => {
let newImgs = []
return imgs.reduce(function(pre,item,index,imgs){
var begin =index*num;
var end =begin+num;
var res = imgs.slice(begin,end);
if(res.length != 0){
newImgs[index] = res;
}
return newImgs;
},[]);
}
标签:index,一组,res,js,var,num,数组,imgs,newImgs
From: https://www.cnblogs.com/ZerlinM/p/16942024.html