【发布时间】:2021-10-02 13:22:08
【问题描述】:
我将此代码添加到mounted()
mounted() {
fetch('http://127.0.0.1/logined')
.then(
function(response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
// Examine the text in the response
response.json().then(function(data) {
console.log(data);
});
}
)
.catch(function(err) {
console.log('Fetch Error :-S', err);
});
}
它没有修复,API 运行良好。
API 返回
{'result':'false'}
控制台日志
这个问题没有为我解决,我在另一台电脑上试过,但还是一样。 Axios 也不行,所以我改成 fetch。
【问题讨论】:
标签: api vue.js get frontend fetch