小编SBD*_*SBD的帖子

Meteor:Uncaught ReferenceError:未定义帐户

我正在学习关于学习MeteorJS的教程,但是在调用'Accounts'对象方法'createUser'时我遇到了这个奇怪的错误:

Meteor:  Uncaught ReferenceError: Accounts is not defined
Run Code Online (Sandbox Code Playgroud)

我查阅了文档,Meteor提供了一个关于在项目中安装Meteor的整个帐户系统.(https://www.meteor.com/accounts).这个错误的原因是什么?我找不到答案.

我的代码:

if (Meteor.isClient) {



 Template.login.creatingAccount = function()
  {
    return Session.get('creatingAccount');

  }, 



Template.login.events({


    'click #loginform': function()
    {
        Session.set('creatingAccount', false);
    }, 
    'click #accountform': function()
    {
        Session.set('creatingAccount', true);
    },
    'click #createAccount': function(e,t)
    {
        //make sure to show the login form
        Session.set('creatingAccount', false);
        Accounts.createUser({ 

            username: t.find('#username').value, 
            password: t.find('#password').value, 
            email: t.find('#email').value, 
            profile: {
                name: t.find("#username").value, 
                email: t.find("#email").value
            }

        });

    },

  });
}
Run Code Online (Sandbox Code Playgroud)

javascript meteor

4
推荐指数
1
解决办法
3282
查看次数

标签 统计

javascript ×1

meteor ×1