how to return response of axios in return
问题 I want to return the response of axios but always the response that returned is undefined: 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)); The console always logs as undefined. Is their any way returning this response. 回答1: console.log