我在一处地方要调用 logInWidthMobilePhone(),想要获取signUpOrlogInWithMobilePhone中的返回结果,但是logInWidthMobilePhone返回的始终是undefined:
export default{
logInWidthMobilePhone(phone, code) {
leanStorage.User.signUpOrlogInWithMobilePhone(phone, code).then((success) => {
// 成功
return success
}, (error) => {
// 失败
return error
});
}
}
请问我该怎么实现?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
里面的函数
leanStorage要使用return返回Promise, 而且这个函数本身也要使用return返回;这样logInWidthMobilePhone的结果也是一个Promise.return一下试试