Javascript 在Firebase和Vue中创建新用户
您好,我正在尝试使用Vue和Firebase创建用户系统。我已经在项目中添加了所需的Firebasescript和一些代码。 问题是,每次我点击submit按钮时,它都不会在Firebase中创建用户。希望你能帮助我。:) 谢谢你的帮助 密码长度必须为8-20个字符,包含字母和数字,并且不得包含空格、特殊字符或表情符号。 提交 从“firebase”导入firebase 导出默认值{ 姓名:'签名', 道具:{ msg:String }, 数据(){ 返回{ 表格:{ 电子邮件:“”, 密码:“” }, 秀:真的 } }, 方法:{ onSubmit(evt){ evt.preventDefault() firebase.auth().createUserWithEmailAndPassword(this.email,this.password)。然后( (用户)=>{ 此。$router.replace('home')) }, (错误)=>{ 警报('Oops.'+错误消息) } ) }, ON复位(evt){ this.form.email='' this.form.password=“” this.show=false 这个.$nextTick(()=>{ this.show=true }) } } } 在模板中执行Javascript 在Firebase和Vue中创建新用户,javascript,firebase,vue.js,Javascript,Firebase,Vue.js,您好,我正在尝试使用Vue和Firebase创建用户系统。我已经在项目中添加了所需的Firebasescript和一些代码。 问题是,每次我点击submit按钮时,它都不会在Firebase中创建用户。希望你能帮助我。:) 谢谢你的帮助 密码长度必须为8-20个字符,包含字母和数字,并且不得包含空格、特殊字符或表情符号。 提交 从“firebase”导入firebase 导出默认值{ 姓名:'签名', 道具:{ msg:String }, 数据(){ 返回{ 表格:{ 电子邮件:“”, 密码:“
<b-form-input ... v-model="email" ...></b-form-input>
但是您将数据
声明为
data () {
return {
form: { // <=== see the form here, that is not taken into account in the above parts of your code
email: '',
password: ''
},
show: true
}
},
另一种方法是:
data () {
return {
email: '',
password: '',
show: true
}
},
firebase.auth().createUserWithEmailAndPassword(this.form.email, this.form.password).then(...)
我建议你使用。调试这些基本问题将有很大帮助…非常感谢!
data () {
return {
email: '',
password: '',
show: true
}
},
firebase.auth().createUserWithEmailAndPassword(this.form.email, this.form.password).then(...)