fetch和axios获取数据

Posted hello芳芳

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
});

以上是关于fetch和axios获取数据的主要内容,如果未能解决你的问题,请参考以下文章