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

Warning: [ant-design-vue: Form.Item] FormItem can only collect one field item, you haved set ASelect, AInput 2 field items. #2538

Closed
4 tasks
luocong2016 opened this issue Feb 9, 2023 · 6 comments

Comments

@luocong2016
Copy link
Contributor

⚠️ 重要 ⚠️ 在进一步操作之前,请检查下列选项。如果您忽视此模板或者没有提供关键信息,您的 Issue 将直接被关闭

  • 已阅读 文档.
  • 确保您的代码已是最新或者所报告的 Bug 在最新版本中可以重现. (部分 Bug 可能已经在最近的代码中修复)
  • 已在 Issues 中搜索了相关的关键词
  • 不是 ant design vue 组件库的 Bug

描述 Bug

warning.js:6 Warning: [ant-design-vue: Form.Item] FormItem can only collect one field item, you haved set ASelect, AInput 2 field items.
You can set not need to be collected fields into a-form-item-rest
image

image

请清晰地描述此 Bug 的具体表现。

复现 Bug

仅是警告
https://www.antdv.com/components/form-cn#components-form-demo-customized-form-controls

请描述在演示页面中复现 Bug 的详细步骤,以确保我们可以理解并定位问题。部分 Bug 如果未在 Demo 中涉及,请务必提供关键代码

系统信息

  • 操作系统:
  • Node 版本:
  • 包管理器 (npm/yarn/pnpm) 及其版本:
@luocong2016
Copy link
Contributor Author

BasicForm 应该有个取消默认包裹属性,让开发者自己写

@lzdjack
Copy link
Contributor

lzdjack commented Feb 9, 2023

你可以在自己需要自定组件的插槽里写个FormItem

@luocong2016
Copy link
Contributor Author

luocong2016 commented Feb 9, 2023

@lzdjack 还要写样式覆盖,而且嵌套几个,而且是个插槽的父级 Form.Item。而且是模版开发的,如果用 TSX 开发的加几个参数,写个if 就解决了

@slmev
Copy link

slmev commented Mar 13, 2023

Form.Item的参数autoLink设置为false

@YernarT
Copy link

YernarT commented Apr 1, 2024

亲测好用, 有些时候自定义组件里有多个数据入口, 这个时候加上 autoLink=false, 可以避免报错

image

@xieerduos
Copy link

xieerduos commented May 30, 2024

亲测有用, 使用 包裹 不需要检验的input

https://www.antdv.com/components/form-cn#_3-x

<a-form-item>
  <a-input name="a"></a-input>
  <a-form-item><a-input name="b"></a-input></a-form-item>
</a-form-item>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants