const formData = new FormData()
let arr=[{a:1,c:3},{a:2,c:4}];
for(let i=0;i<arr.length;i++){
for(let key in arr[i]){
//假设这个数组对应的字段为box
formData.append(`box[${i}][${key}]`,arr[i][key])
}
}
const formData = new FormData()
let arr=[{a:1,c:3},{a:2,c:4}];
for(let i=0;i<arr.length;i++){
for(let key in arr[i]){
//假设这个数组对应的字段为box
formData.append(`box[${i}][${key}]`,arr[i][key])
}
}
本文标题:formData传数组作为参数-转自csdn的linecloud
本文链接:https://www.haomeiwen.com/subject/lzpvghtx.html
网友评论