fetch('books/123',{
method:'put',
body:JSON.stringify({
uname:'lisi',
age:15
})
headers:{
'Content-Type':'application/json',
}
}).then(data => {
return data.text();
}).then(ret => {
//这里才是得到的最终数据
console.log(ret);
})
//后台接收参数为req.body.uname + '--' + req.body.age + '---' + req.params.id
fetch_put请求方式的参数传递
最新推荐文章于 2024-04-15 19:45:53 发布