即使确认密码为真,我也有以下错误。
这是我的求职表
<div class="control-group">
<input type="password" v-validate="passwordRule" name="password" id="password"
placeholder="Password" class="form-control"
data-vv-as="Password"
v-model="user.password">
<span class="red" v-show="errors.has('password')">{{ errors.first('password') }}</span>
</div>
<div class="control-group">
<input type="password" v-validate="confirmPasswordRule || passwordRule" name="confirm_password" id="confirm_password"
placeholder="Re-enter Password" class="form-control"
data-vv-as="Re-enter Password"
v-model="user.confirm_password">
<span class="red" v-show="errors.has('confirm_password')">{{ errors.first('confirm_password') }}</span>
</div>
这些是我的规则
computed: {
passwordRule() {
return this.user.password.length ? 'required' : '';
},
confirmPasswordRule() {
console.log('conf called');
return this.user.confirm_password.length ? 'required|confirmed:password' : '';
}
},