我想让当前用户在公共场合使用,但在 Parse.User.currentAsync((.then(function(user( 当前用户未定义,如何将其传递给变量?
var userName;
Parse.User.currentAsync().then(function(user) {
userName = user.get('username')
});
alert(userName) //undefined
......
user.equalTo("username", userName); //userName is undefined
user.find().then(results => {
for(const result of results) { ....
const user = await Parse.User.currentAsync();
alert(user.getUsername());