try this solution :
<template>
<div>
<div>
<label>Current Password:</label>
<input type="password" v-model="updatePassword.CurrentPassword"/>
<div v-if="updatePasswordValidate.CurrentPassword.$errors.length">
{{ updatePasswordValidate.CurrentPassword.$errors[0].$message }}
</div>
</div>
<div class="mb-4">
<label>New Password:</label>
<input type="password" v-model="newPassword"/>
<div v-if="updatePasswordValidate.NewPassword.$errors.length">
{{ updatePasswordValidate.NewPassword.$errors[0].$message }}
</div>
</div>
<div>
<label>Re-type New Password:</label>
<input type="password" v-model="updatePasswordValidate.retypePassword.$model"/>
<div v-if="updatePasswordValidate.retypePassword.$errors.length">
{{ updatePasswordValidate.retypePassword.$errors[0].$message }}
</div>
</div>
<div>
<button
id="updatePassBtn"
@click="updateUserPassword"
type="button">Change Password</button>
</div>
</div>
</template>
<script>
import useVuelidate from "@vuelidate/core";
import {required, sameAs, minLength} from "@vuelidate/validators";
export default {
data() {
return {
updatePasswordValidate: null,
newPassword: "",
updatePassword: {
CurrentPassword: null,
NewPassword: null,
},
};
},
components: {BaseAlert},
watch: {
newPassword(newV) {
this.updatePassword.NewPassword = newV;
this.loadValidation();
},
},
computed: {
rulesUpdatePassword() {
return {
CurrentPassword: {
required,
minLength: minLength(8),
},
NewPassword: {
required,
minLength: minLength(8),
},
retypePassword: {
required,
minLength: minLength(8),
sameAs: sameAs(this.updatePassword.NewPassword, "New Password"),
},
};
},
},
props: {
token: {
required: true,
},
},
methods: {
updateUserPassword() {
console.log('handle update button')
},
loadValidation() {
this.updatePasswordValidate = useVuelidate(
this.rulesUpdatePassword,
this.updatePassword
);
},
},
created() {
this.loadValidation();
},
};
</script>