当前位置:网站首页>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>
边栏推荐
- 分布式-总结列表
- Vmware workstation network card settings and three common network modes
- 【暑期每日一题】洛谷 P2637 第一次,第二次,成交!
- [summer daily question] Luogu p5886 Hello, 2020!
- Like cloud functions
- STM32扩展板 温度传感器和温湿度传感器的使用
- Global and Chinese market of paper machine systems 2022-2028: Research Report on technology, participants, trends, market size and share
- STM32 光敏电阻传感器&两路AD采集
- HCIP Day13
- LevelDB源码分析之memtable
猜你喜欢
![[data recovery in North Asia] a data recovery case of raid crash caused by hard disk drop during data synchronization of hot spare disk of RAID5 disk array](/img/22/606ff1e8dad3d5896b32d2146b0477.jpg)
[data recovery in North Asia] a data recovery case of raid crash caused by hard disk drop during data synchronization of hot spare disk of RAID5 disk array

Pytoch (IV) -- visual tool visdom

Distributed - summary list

LevelDB源码分析之LRU Cache

Single page application

How to use common datasets in pytorch

Copy baby prompt: material cannot be empty. How to solve it?

Software intelligence: the "world" and "boundary" of AI sentient beings in AAAs system

分布式架构系统拆分原则、需求、微服务拆分步骤

导电滑环使用的注意事项
随机推荐
Global and Chinese markets of gps/gnss receiver modules 2022-2028: Research Report on technology, participants, trends, market size and share
Character input stream and character output stream
HCIP Day13
Global and Chinese market for kitchen range hoods 2022-2028: Research Report on technology, participants, trends, market size and share
【暑期每日一题】洛谷 P5886 Hello, 2020!
每日一题-LeetCode1175-质数排列-数学
Global and Chinese market of protection circuit modules 2022-2028: Research Report on technology, participants, trends, market size and share
Neural network convolution layer
对象的序列化与反序列化
Detailed explanation of distributed global unique ID solution
Global and Chinese market of 3D design and modeling software 2022-2028: Research Report on technology, participants, trends, market size and share
RuntimeError: mean(): input dtype should be either floating point or complex dtypes. Got Long instead
Youqitong [vip] v3.7.2022.0106 official January 22 Edition
Pytoch (III) -- function optimization
Some tools that research dogs may need
Copier le matériel de conseils de bébé ne peut pas être vide, comment résoudre?
Global and Chinese market of metal oxide semiconductor field effect transistors 2022-2028: Research Report on technology, participants, trends, market size and share
如何选择导电滑环材料
LeetCode522-最长特殊序列II-哈希表-字符串-双指针
Global and Chinese market of mainboard 2022-2028: Research Report on technology, participants, trends, market size and share

