【发布时间】:2020-04-01 07:34:39
【问题描述】:
我的 vue js 组件中有一个电子邮件字段。当组件加载时,它会获取我在注册期间添加的电子邮件值。但是,当我尝试使用 updateEmail 将我的电子邮件更新为新的 emai 时,它会返回错误 code: "auth/argument-error", message: "updateEmail failed: First argument "email" must be a valid string."。
<template>
<div>
<form @submit.prevent="onUpdateProfile">
<input type="email" v-model="profile.email" placeholder="Enter Your Email..." class="from-input" />
<button type="submit">submit</button>
</form>
</div>
</template>
data() {
return {
profile: {
email: ""
}
};
},
methods:{
onUpdateProfile() {
firebase.auth().onAuthStateChanged(user => {
if (user) {
user.updateEmail({
email: this.profile.email
})
.then(() => {})
.catch(error => {
console.log(error);
});
}
}
},
created() {
firebase.auth().onAuthStateChanged(user => {
if (user) {
this.profile.email = user.email;
}
}
}
【问题讨论】: