fetch和axios获取数据

fetch("/api/goods")
.then(res => {
return res.json();
})
.then(response => {
console.log(response);
if (response.code == 0) {
this.poiInfo = response.data.poi_info;
}
});
 
axios.get("/api/goods").then(res => {
var res = JSON.parse(res.request.responseText);
this.poiInfo = res.data.poi_info;
});

猜你喜欢

转载自www.cnblogs.com/hellofangfang/p/9895513.html