Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在form中 使用v-if渲染的form-item 在不渲染的时候也进行了必填验证?? #367

Closed
1 task
feng9217 opened this issue Jan 3, 2019 · 8 comments
Labels

Comments

@feng9217
Copy link

feng9217 commented Jan 3, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.1.1

Environment

vue 2.9.6 Chrome/71.0.3578.98

Reproduction link

Edit on CodeSandbox

Steps to reproduce

在form中 使用v-if对不同的form-item进行渲染 选择其中一个值渲染出表单后 再选另一个值渲染对应的表单 结果前值的表单的必填项也跟着被验证了
例如重现例子中 我选了1 再选2 结果1中的必填表单也被验证了

What is expected?

根据当前的 v-if 验证 对应的必填项(在选择过后)

What is actually happening?

全部都给验证了


重现链接里的 ant-design-vue 加载不出来?

@feng9217
Copy link
Author

feng9217 commented Jan 3, 2019

例如代码是这样的:
image
image
image
在我选择了自派车又选择了物流后 form.validateFields 就验证出了自派车时的必填项
image

@tangjinzhou
Copy link
Member

没发现问题,确定是1.2.4版本?
and 建议先把控制台一堆的警告先解决了
image

@feng9217
Copy link
Author

feng9217 commented Jan 4, 2019

https://codesandbox.io/s/q7o52l8x86
更新了 看了是用的1.1.1的版本 ..
之前开发也没见控制台有这些 一直就这样用了 ..
已经可以复现了 先选了一个派车方式 再选另一个 填完再提交 ~

@tangjinzhou
Copy link
Member

升级到1.2.4

@feng9217
Copy link
Author

feng9217 commented Jan 4, 2019

image
已进行升级, 点击提交后还是出现 .....
在线地址也已更新, 可复现
image

@tangjinzhou
Copy link
Member

抱歉回复晚了 ,
可以给form-item添加唯一key解决
https://codesandbox.io/s/q7o52l8x86

@tangjinzhou
Copy link
Member

重新安装依赖也可解决问题, 升级底层依赖vue-ref

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants