📅  最后修改于: 2022-03-11 15:02:27.805000             🧑  作者: Mango
var myRequest = new Request('products.json');//GET
var myRequest = new Request('products.json', {method: "post"});//POST
fetch(myRequest)
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(console.error);