我想(出于好奇)在尝试使用 Meteor 应用程序时查看我的 userId。我正在尝试以这种方式显示它:
HTML:
<body>
. . .
<div class="container">
{{> userIdTemplate}}
{{> postTravelWizard}}
</div>
</body>
<template name="userIdTemplate">
{{getUserId}}
</template>
Javascript:
Template.userIdTemplate.helpers({
getUserId: function () {
return Meteor.userId;
}
});
单步浏览 CDT 中的 .js,我看到 Meteor.userId 的值是“未定义”。我没有经过身份验证 - 只需运行仍然安装了不安全包的应用程序。这就是 userId 未定义的原因吗?