我正在努力掌握流星,但我是一个初学者。在这里寻求一个非常基本的东西的帮助。如何用流星创建一个登录系统?
如何创建2种形式(登录名和密码输入)和一个按钮,将注册使用Accounts.createUser(options, [callback])
我需要了解如何两种形式拴在功能非常基本的东西的帐户。
编辑:我试过一件事。尽管完全失明。
if (Meteor.isClient) {
Template.login.account = function() {
if (Meteor.user() == null) {
return
<form id="login">
<input type="email" id="email" />
<input type="text" id="logintext" />
<input type="password" id="password" />
</form>
};
};
Template.login.events({
'click input' : Sumbit();
})
}
function Sumbit(){
var login, password, email;
document.getElementById('email').value = email;
document.getElementById('logintext').value = login;
document.getElementById('password').value = password;
Accounts.createUser(login, email, password)
}
@BigTeddy是对的。另外,你不能直接在JavaScript文件中编写你的模板,你必须创建一个带'.html'扩展名的单独文件。 – mquandalle
@mquandalle我在那里制作了带有模板的.html文件。只是没有在这里添加它,我的坏。 – Euphe