我正在使用vee-validate库验证我的表单。 但我确认密码有问题: 在我的html组件中我有:
<div :class="{'form-group': true, 'has-error': errors.has('password')}">
<label for="password" class="control-label">New password</label>
<input v-validate="'required|min:5|confirmed:password_confirmation'" type="password" class="form-control" id="password" name="password" placeholder="New Password" v-model="settings.password">
<p class="help-block" v-if="errors.has('password')">{{errors.first('password')}}</p>
</div><!--end form group-->
<div :class="{'form-group': true, 'has-error': errors.has('password_confirmation')}">
<label for="password_confirmation" class="control-label">Verify password</label>
<input v-validate="'required'" type="password" class="form-control" id="password_confirmation" name="password_confirmation" placeholder="Verify password" v-model="settings.password_confirmation">
</div>
在我的剧本中
import VeeValidate from 'vee-validate';
Vue.use(VeeValidate);
export default {
data() {
return {
settings: {
password: '',
password_confirmation: ''
}
}
}
}
但它总是返回确认密码与密码不同的错误。 我错了什么?