Promise返回值如何赋值
var nickname = ‘’;
getUser.info(data.sendUserId).then(function (res) {
nickname = res.nickname
console.log(nickname) //有值的
})
console.log(nickname) //无值的
var nickname = ‘’;
getUser.info(data.sendUserId).then(function (res) {
nickname = res.nickname
console.log(nickname) //有值的
})
console.log(nickname) //无值的