要返回返回未定义Axios公司,但总是响应的响应:我如何返回爱可信的响应回报
wallet.registerUser=function(data){
axios.post('http://localhost:8080/register',{
phone:data.phone,
password:data.password,
email:data.email
}).then(response =>{
return response.data.message;
console.log(response.data.message);
}).catch(err =>{
console.log(err);
})
}
console.log(wallet.registerUser(data));
控制台始终记录为未定义。他们以任何方式返回这个回应。
的[我如何回报可能的复制来自异步调用的响应?](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call) –