2022-04-22 10:37:00 +00:00
|
|
|
const arrTool = {
|
2022-05-21 05:28:54 +00:00
|
|
|
/**
|
|
|
|
* @description 一维数组变二维数组
|
|
|
|
* @param {Array} arr
|
|
|
|
* @param {Number} size
|
|
|
|
*/
|
|
|
|
oneArrToTwo(arr, size) {
|
2022-04-22 10:37:00 +00:00
|
|
|
var arrTwo = []
|
|
|
|
for (var i = 0; i < arr.length; i = i + size) {
|
|
|
|
arrTwo.push(arr.slice(i, i + size))
|
|
|
|
}
|
|
|
|
return arrTwo // 新的二维数组
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default arrTool;
|