<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="100px" v-loading="loading">
<el-form-item label="负责人" prop="directorName">
<el-input v-model="form.directorName" placeholder="请输入负责人"/>
</el-form-item>
<el-form-item label="项目名称" prop="projectVO.projectName">
<el-input v-model="form.projectVO.projectName" placeholder="请输入项目名称"/>
</el-form-item>
<el-form-item label="规格:" prop="res.0.standards">
<el-input v-model="goods.res[0].standards" placeholder="规格"></el-input>
</el-form-item>
</el-form>
// 定义校验规则
const dataRules = ref({
directorName: [{ required: true, message: '请填写负责人', trigger: 'blur' }],
projectVO: {
projectName:[{ required: true, message: '申请项目不能为空', trigger: 'blur' }]
},
res: [{
standards: [
{required: true, message: '请输入规格', trigger: 'blur'},
{min: 1, max: 200, message: '长度在 10 到 200 个字符', trigger: 'blur'}
],
serve: [
{required: true, message: '请输入服务', trigger: 'blur'},
{min: 1, max: 200, message: '长度在 10 到 200 个字符', trigger: 'blur'}
]
}],
})
https://blog.csdn.net/PlanetWalk/article/details/130616002
标签:200,form,校验,表单,trigger,blur,message,true From: https://www.cnblogs.com/linhan8888/p/17818959.html