【发布时间】:2017-12-12 15:14:53
【问题描述】:
我正在尝试console.log(Meteor.user().profile.group):但它会导致以下错误:
未捕获的类型错误:无法读取未定义的属性“配置文件”
单独使用Meteor.user() 会返回未定义。
这里是 Mongo 的用户详细信息:
{
"_id" : "ccZztbFqw2MpgTsjX",
"createdAt" : ISODate("2017-12-12T15:11:23.645Z"),
"services" : {
"password" : {
"bcrypt" : "$2a$10$lsYo7wjhA77.8TmNYeMTQ.u3jZzJSiIxsJrMRkjOPINHuLhBOENqm"
}
},
"emails" : [
{
"address" : "111@211.com",
"verified" : false
}
],
"profile" : {
"name" : "11111",
"createdAt" : ISODate("2017-12-12T15:11:23.558Z"),
"updatedAt" : ISODate("2017-12-12T15:11:23.558Z"),
"group" : "user"
}
}
为什么 Meteor.user() 在 Chrome 中不起作用?
注意:Meteor.user().profile.group 使用 Microsoft Edge 浏览器将组打印到控制台
【问题讨论】:
-
它在 Chrome 中工作,只需几毫秒即可加载到客户端。这个问题老是出现。
-
@MichelFloyd 你的权利,我把它放在一个按钮内,可以成功打印组。延迟执行的最佳做法是什么?
-
取决于你使用的是 Blaze 还是 React。
标签: google-chrome meteor meteor-accounts