ElemeFE / ElemeFE/element

[bug report] dynamic formitem causes the rule verification of form to be invalid

Open
#18,642 2 comments 0 reactions 0 assignees View on GitHub
stale
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

### Element UI version
2.13.0

### OS/Browsers version
MacOs 10.13.6 / Chrome 79

### Vue version
2.6.11

### Reproduction Link
https://codepen.io/wgcg/pen/bGNLvPg

### Steps to reproduce
1. click the switch button
2. click "立即创建"

### What is Expected?
"活动形式"的规则进行校验 给予相应的错误提示

![image](https://user-images.githubusercontent.com/20108513/71964963-afab8680-3239-11ea-9e65-6f027049cb98.png)

### What is actually happening?
没有在活动形式的输入框输入内容 但是校验通过了

**原因**

复用了之前的FormItem实例,不会触发FormItem的mounted事件,也就不会push进form.fields中

**临时解决方案**

1. 给”活动备注“的FormItem组件增加prop属性,这样在mounted时就会把该组件实例push进form.fields中,切换后复用了该组件,会更新它的prop属性,这样就能正常校验了
2. 给"活动形式"的FormItem增加key属性,避免复用

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.