fetch 基本Api

xiaoxiao2021-02-28  83

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); })
转载请注明原文地址: https://www.6miu.com/read-41938.html

最新回复(0)