Element el-form 根据选择条件动态控制表单必填项
Html:
<el-form-item label="审核意见" prop="remark" :rules="recordForm.status == '10' ? rules.remark : [{required: false}]"> <el-input type="textarea" v-model="recordForm.remark"></el-input> </el-form-item>
Js:
data(){
return {
rules: [
{
required: true, message: "请填写审批意见", trigger: "blur"
}
]
}
}
注意:rules判断要写在el-form-item中