form表单使用v-if
时间: 2023-10-19 20:30:02 浏览: 92
引用中提到了使用v-if和v-show来控制form表单的显示和隐藏。使用v-if时,在切换条件下,由于表单项进行渲染,校验规则也没有绑定上,导致校验不会生效。而使用v-show时,即使隐藏了,表单项的校验规则仍然会生成并进行校验。因此,如果要在切换条件下进行校验,建议使用v-show来控制form表单的显示和隐藏。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [el-form表单校验与v-if使用时表单校验失效](https://blog.csdn.net/qq_49278026/article/details/125194864)[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_1"}}] [.reference_item style="max-width: 50%"]
- *3* [【VUE的Form表单】使用v-if切换控件时,表单校验不生效](https://blog.csdn.net/weixin_55846296/article/details/127094480)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文