el-form-item 绑定rules
时间: 2023-11-05 22:19:40 浏览: 195
el-form-item 绑定rules的方式有多种,根据你提供的引用内容,其中一种方式是通过动态绑定prop的方式来实现。在你的代码中通过使用三目运算符将规则绑定到prop上,例如`:prop='isNameRules?rules.nameRule:[{required: false}]'`。这样,当`isNameRules`为真时,将绑定`rules.nameRule`作为规则,否则绑定`[{required: false}]`作为规则。这样做可以根据某个条件来动态设置表单校验的规则。 <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [【elementUI】el-form-item 动态绑定rules校验规则](https://blog.csdn.net/weixin_43900414/article/details/125145069)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [vue element table中自定义一些input的验证操作](https://download.csdn.net/download/weixin_38674627/14801427)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文