I don"t know why. "Please enter your password" is displayed as soon as the page is refreshed. The code is as follows:
html section:
<div class="reg-group reg-pass">
<label for="pass">:</label>
<input type="text" id="pass" v-model="pass" :class="{"error":$v.pass.$error}" @blur="$v.pass.$touch()">
<span v-show="!$v.pass.required"></span>
<span v-show="!$v.pass.minLength || !$v.pass.maxLength">6~16</span>
</div>
<div class="reg-group reg-sure-pass">
<label for="sure-pass">:</label>
<input type="text" id="sure-pass" v-model="surePass" @blur="$v.surePass.$touch()">
<span v-show="!$v.surePass.required"></span>
<span v-show="!$v.surePass.sameAs"></span>
</div>
js section:
import {required, minLength, maxLength, between, sameAs} from "vuelidate/lib/validators";
export default {
name: "vuelidate-pri",
data (){
return {
flag: "",
name: "",
user: "",
age: "",
pass: "",
surePass: "",
phone: "",
status: ""
};
},
validations: {
pass: {
required,
minLength: minLength(6),
maxLength: maxLength(16)
},
surePass: {
required,
sameAs: sameAs("pass")
},
phone: {
}
}
}
This is what happens when the
page is refreshed. Hurry, ask for God!