0

使用 xxx 时,我的夹具方法是否应该知道this.userId我是否已登录?

'userId': function () {
      console.log("#################");
      console.log("################# USERID: ", this.userId);
      console.log("#################");
    }

null当从步骤定义中调用时,它总是会打印出来。

4

1 回答 1

1

如果您从步骤定义中调用它,则this.server.call您正在建立服务器到服务器的连接,因此您将不会登录。

您需要使用客户端进行调用以进行身份​​验证:

this.client.executeAsync(function() {
  Meteor.call('userId') // this will be sent from the client
});
于 2015-07-13T23:13:29.093 回答