【发布时间】:2020-05-21 12:16:49
【问题描述】:
我正在使用以下 fetch 命令,它工作正常。
问题是:这仅适用于 IP 而不适用于名称。 如果我尝试替换 IP 并输入 actual name 类似这样的内容,则会出现错误 你能告诉我是什么问题吗,或者你可以参考一些东西,我会读一下。
不适用于名称: "http://tmSpn01.LayaMs.com:5432/Quotations/api/UserQuotations"
使用 IP 地址:
fetch('http://192.78.87.89:3472/Quotations/api/UserQuotations')
.then((response) => response.json())
.then((responseJson) => {
return responseJson.articles;
})
.then( articles => {
setArticles(articles);
//console.log(articles);
setLoading(false);
})
.catch( error => {
console.error(error);
});
【问题讨论】:
-
检查服务器上的
UserQuotations文件,它是否位于此路径http://tmSpn01.LayaMs.com:5432/Quotations/api/UserQuotations上
标签: react-native fetch