赞
踩
问题:做一个动态表单规则的需求, 但是赋值给rules规则值之后,初始化的时候或者更改rules,表单就会立即检验报红。
解决办法:通过form组件属性配置解决 (validate-on-rule-change=“false”)
官网解释:
<el-form ref="ruleFormDom" class="formDom" :model="ruleForm" :rules="rules" label-width="180px" :validate-on-rule-change="false"> <el-form-item label="起止日期"> <el-col :span="11"> <el-form-item prop="date1"> <el-date-picker v-model="ruleForm.date1" type="date" placeholder="选择日期" style="width: 100%;" /> </el-form-item> </el-col> <el-col class="line" :span="2">-</el-col> <el-col :span="11"> <el-form-item prop="date2"> <el-date-picker v-model="ruleForm.date2" type="date" placeholder="选择日期" style="width: 100%;" /> </el-form-item> </el-col> </el-form-item> </el-form>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。