我想让当前用户可以在Parse.User.currentAsync()之外的公共场所使用。然后(函数(用户)当前用户未定义,如何将其传递给变量??
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) { ....
答案 0 :(得分:0)
const user = await Parse.User.currentAsync();
alert(user.getUsername());