【发布时间】:2020-02-14 12:27:10
【问题描述】:
之前有人问过,但是如果我仍然在控制台中按照解决方案进行操作,则会出现一个粗俗的错误:-
getExchangeAmount(){
var url = 'http://localhost:8080/excurrency?currency='+this.state.currency+
'&exCurrency='+this.state.excurrency+'&amount='+this.state.amount
axios.get(url)
.then(response => {
// success
this.setState({result: response.data})
})
.catch((error) => {
// handle this error
console.log('error: '+error);
})
}
在控制台中:-
获取 http://localhost:8080/excurrency?currency=EGP&exCurrency=EGP&amount=1 网络::ERR_CONNECTION_REFUSED
上面是红色的,这是一个错误。如何避免或抓住这个?
【问题讨论】:
-
你有没有想过这个问题?我有一个非常相似的问题让我发疯