Pass v-model email value to method
P粉882357979
P粉882357979 2024-04-05 10:04:40
0
1
407

Hi, I'm trying to pass v-model on the input to try to send the email to reset the validation, but I don't know how to pass it correctly from the input to sendPasswordResetEmail. This is what I have so far

methods:{
  
      resetPassword(){
          const auth = app.auth();          
          const userEmail = ref('')
          auth.sendPasswordResetEmail(userEmail.value).catch((error) =>  {
              console.log(error);
          });
          alert('Reset email has been sent')
          console.log(userEmail)
          
      },
    },

This is the input part

<form v-if="reset" @submit.prevent="resetPassword">
<input type="email" required placeholder="email" v-model="userEmail" class="inline-block">
<button>Reset Password</button>
 
</form>

I've also been trying to return userEmail, but nothing seems to work.

P粉882357979
P粉882357979

reply all(1)
P粉731861241

Check if you are getting user email value in resetPassword() function. If not, then the problem is with the reference.

Correct this line,

const userEmail = ref('')

If you use values ​​from HTML v-model, you must use the this keyword.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!