<el-form :model="signForm" status-icon :rules="formRule" ref="signForm" label-width="100px">
</el-form>
formRule验证规则为:
formRule: {
sign_name: [
{required: true, message: '请输入签到名称', trigger: 'blur'}
]
}
:model="signForm" status-icon :rules="formRule" ref="signForm"
提交按钮在el-form之内
绑定事件的方式为: @click="submitForm('signForm')"
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
//验证通过
} else {
return false;
}
});
}