fetch('/api/user/newsDetail', {
method: 'post',//方法
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
//参数类型
},
body: 'foo=bar&favColor=blue&password=easytoguess'
//参数
})
.then(response => response.json())//后台数据解析
.then(function (data) {
console.log(data);
})
.catch(function (error) {
console.log('Request failed', error);
})
fetch 基本Api
最新推荐文章于 2025-04-24 08:00:00 发布