当前位置:网站首页>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>
边栏推荐
- Programmers dig "holes" to get rich: if they find a loophole, they will be rewarded 12.72 million yuan
- QDataStream的简单读写验证
- 导电滑环短路的原因以及应对措施
- Youqitong [vip] v3.7.2022.0106 official January 22 Edition
- Global and Chinese market of metal oxide semiconductor field effect transistors 2022-2028: Research Report on technology, participants, trends, market size and share
- 工业导电滑环的应用
- Oracle views the creation time of the tablespace in the database
- Some common commands of podman
- 【暑期每日一题】洛谷 P2637 第一次,第二次,成交!
- LeetCode1497-检查数组对是否可以被 k 整除-数组-哈希表-计数
猜你喜欢

Implementation of distributed lock

导电滑环使用的注意事项

RuntimeError: mean(): input dtype should be either floating point or complex dtypes. Got Long instead

每日一题-LeetCode1175-质数排列-数学
![[hard ten treasures] - 2 [basic knowledge] characteristics of various topological structures of switching power supply](/img/c2/6dfb9f477306edb46ff2a6a6ca32dd.png)
[hard ten treasures] - 2 [basic knowledge] characteristics of various topological structures of switching power supply

Leetcode1497- check whether array pairs can be divided by K - array - hash table - count

STM32扩展版 按键扫描

复制宝贝提示材质不能为空,如何解决?

How to traverse massive data in redis

STM32扩展板 数码管显示
随机推荐
Several methods of creating thread classes
Some common commands of podman
AcWing 888. Finding combinatorial number IV (the problem of finding combinatorial number with high precision)
打印流与System.setout();
Unity drags and modifies scene camera parameters under the editor
【暑期每日一题】洛谷 P1568 赛跑
How to traverse massive data in redis
线程安全问题
AcWing 886. Finding combinatorial number II (pretreatment factorial)
QDataStream的簡單讀寫驗證
Sqlplus connects using the instance name
Print stream and system setout();
Buffer stream and transform stream
字符输入流与字符输出流
【暑期每日一题】洛谷 P2026 求一次函数解析式
液压滑环的特点讲解
Global and Chinese market of paper machine systems 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets of InGaAs APD arrays 2022-2028: Research Report on technology, participants, trends, market size and share
Unit testing with mongodb
Pytoch (I) -- basic grammar

