📅  最后修改于: 2022-03-11 15:04:28.853000             🧑  作者: 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);