有的时候,前端向后端发送请求,json体积太大可以用数据切片分批发送请求
// 原数组
const todolists = this.todolist.tableList
// 切片的待保存数组
const newArr = []
// 切片数量
const section = 15
// 进行切片
for (var i = 0; i < todolists.length; i += section) {
newArr.push(todolists.slice(i, i + section))
}
// 循环切片次数
for (let j = 0; j < newArr.length; j++) {
console.log(newArr[j])
// 发送请求记得使用await 同步提交请求
}
