【发布时间】:2017-01-10 11:55:09
【问题描述】:
我已将 id 从 html 传递给助手,而我的助手是 getusername
getusername(id) {
var username = "";
Meteor.call("getUserName", id, function(error, result) {
if (error) {
console.log("error", error);
}
if (result) {
console.log(result);
username = result;
}
});
return username;
}
当我记录结果时,它记录了我需要的内容,但在 UI 中没有可见的用户名。 当我将它与 Reactive var 一起使用时,它变成无穷大......因为当反应变量值改变它再次执行......
【问题讨论】:
标签: javascript meteor helper