大家下午好,请教一个问题
http post 请求里 我想循环取到多个接口的数据,url是固定的,body 里传入的 building 跟 floor 参数不一样,想让他通过一次请求 .then之后 返回一个数组,请问怎么让参数
[ {building:'810',floor:'110'},{building:'830',floor:'120'} ]
循环下面的 fetch 返回一个数组
fetch("http://xxx", {
method: 'POST',
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: JSON.stringify({
"building": building,
"floor": floor,
})
}).then(res => res.json()).then(json => {这里想得到一个数组}