当前位置:网站首页>el-form表单新增表单项动态校验;el-form校验动态表单v-if不生效;
el-form表单新增表单项动态校验;el-form校验动态表单v-if不生效;
2022-07-01 05:07:00 【i_am_a_div_日积月累_】
一、新增和删除表单项,动态校验。
el-form表单动态动态新增表单进行校验。直接参考 动态增减表单项
二、el-form表单校验v-if不生效、el-form表单校验v-show不生效:
例如有个表单项,通过控制显示两个不同的表单项内容,分别需要校验对应的表单项即可。
如果是直接用v-if,会发现切换时候,校验不生效;
如果直接使用v-show,又发现即使不切换,隐藏了另外的表单项,也会触发校验规则。
正确做法是:使用v-if控制表单项的显示隐藏,同时需要给el-form-item加上自己的 prop=" " 和 key=" " ,这样才能区分。当然:rules 也要有自己对应的提示。
<template v-if="flag">
<el-form-item label="姓名:" prop="name" key="name" :rules="rules.name">
<el-input v-model="formData.name" placeholder=""></el-input>
</el-form-item>
</template>
<template v-else>
<el-form-item label="退回原因:" prop="desc" key="desc" :rules="rules.desc">
<el-input type="textarea" maxlength="500" show-word-limit v-model="formData.desc" placeholder="请填写退回原因"></el-input>
</el-form-item>
</template>
边栏推荐
- 导电滑环使用的注意事项
- [daily question in summer] Luogu p7222 [rc-04] informatics competition
- HCIP Day13
- 担心侵权?必备无版权素材网站分享,不用担心视频剪辑缺素材
- Leetcode522- longest special sequence ii- hash table - String - double pointer
- Buffer stream and transform stream
- C read / write application configuration file app exe. Config and display it on the interface
- Several methods of creating thread classes
- 【暑期每日一题】洛谷 P5740【深基7.例9】最厉害的学生
- Youqitong [vip] v3.7.2022.0106 official January 22 Edition
猜你喜欢

Implementation of distributed lock

Detailed explanation of distributed global unique ID solution

Software intelligence: the "world" and "boundary" of AI sentient beings in AAAs system
![AssertionError assert I.ndim == 4 and I.shape[1] == 3](/img/b1/0109bb0f893eb4c8915df36c100907.png)
AssertionError assert I.ndim == 4 and I.shape[1] == 3
![Solution: thread 1:[< *> setvalue:forundefined key]: this class is not key value coding compliant for the key*](/img/88/0b99d1db2cdc70ab72d2b3c623dfaa.jpg)
Solution: thread 1:[< *> setvalue:forundefined key]: this class is not key value coding compliant for the key*

Data consistency between redis and database

Sqlplus connects using the instance name

液压滑环的特点讲解

分布式全局唯一ID解决方案详解

Technology sharing | broadcast function design in integrated dispatching
随机推荐
RuntimeError: mean(): input dtype should be either floating point or complex dtypes. Got Long instead
Copy baby prompt: material cannot be empty. How to solve it?
线程类的几大创建方法
Principle, technology and implementation scheme of data consistency in distributed database
[une question par jour pendant l'été] course luogu p1568
[hard ten treasures] - 2 [basic knowledge] characteristics of various topological structures of switching power supply
分布式架构系统拆分原则、需求、微服务拆分步骤
Like cloud functions
科研狗可能需要的一些工具
Neural networks - use of maximum pooling
Solution: thread 1:[< *> setvalue:forundefined key]: this class is not key value coding compliant for the key*
AcWing 885. Find the combination number I (recursive preprocessing)
Global and Chinese market of 3D design and modeling software 2022-2028: Research Report on technology, participants, trends, market size and share
QDataStream的简单读写验证
Worried about infringement? Must share copyrightless materials on the website. Don't worry about the lack of materials for video clips
Global and Chinese market of enterprise wireless LAN 2022-2028: Research Report on technology, participants, trends, market size and share
Query long transaction
[daily question in summer] Luogu p5740 [deep foundation 7. Example 9] the best student
[daily question in summer] letter delivery by p1629 postman in Luogu (to be continued...)
LevelDB源码分析之memtable

