处理vue页面字段校验问题
基本的字段校验:
注:trigger:change(改变)/blur(焦点)
const validateAccount=(rule, value, callback) => {};
ruleValidate:{
userAccount: [
{required: true,validator: validateAccount, trigger: 'change' }
],
}
字段重置校验:
this.$refs.formValidate.resetFields();
字段校验是否正确:
this.$refs.formValidate.validate(valid => {
if(valid){
}
})