This my code pen link https://codepen.io/santoshch/pen/bGgKNWV
<label class="form__group is-required">
<span class="form__label">Password</span>
<input
class="form__input" type="password" name="form-password"
v-model="password" @input="$v.password.$touch"
>
<p v-if="$v.password.$dirty">
<span class="form__alert" v-if="!$v.password.required">Required.</span>
<span class="form__alert" v-if="!$v.password.minLength">
{{$v.password.$params.minLength.min}} letters at least.
</span>
</p>
</label>
<!-- Repeat Password -->
<label class="form__group is-required">
<span class="form__label">Repeat<br>password</span>
<input
class="form__input" type="password" name="form-repeat-password"
v-model="repeatPassword" @input="$v.repeatPassword.$touch"
>
<p v-if="$v.repeatPassword.$dirty">
<span class="form__alert" v-if="!$v.repeatPassword.required">Required.</span>
<span class="form__alert" v-if="!$v.repeatPassword.sameAsPassword">
Must be identical.
</span>
</p>
</label>
export default {
data() {
return {
confirmPasswordRules: [
(value) => !!value || 'type confirm password',
(value) =>
value === this.password ||
'The password confirmation does not match.',
],
}
:rules="confirmPasswordRules"
Ya code is working fine which provided in codepen. but one more functionality need to add for confirmPassword filed. i.e, in confirmpassword field, I need to check each and every character with password field, and then i need to display at which character we have entered wrong.