ant-design / ant-design/pro-components

🐛[BUG] ProFormItem下为什么只能放一个组件? 加一层 div 都不行?

Open
#8,481 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

比如图中的这种情况, 要想在 onFinish 的 values 中包含 slider 的值, 则Slider 必须是ProFormItem的唯一子组件.

子组件因为布局要求需要用其他组件包裹的场景如何处理?

我目前是用 useState 给所有的 slider 组件比如 temperature 和 penalty 设置单独 state, 感觉很不优雅.

image

```tsx

{/**/}
{/* */}

{/**/}
{/**/}
{/**/}
{/* */}
{/**/}


```

image

Contributor guide

Open the contributing guide

Research direction

No repository file or test is named. Start by reproducing the ProFormItem example with Slider and a wrapping Row or div, then trace the ProFormItem form-value handling; done means a wrapped child can contribute its value to onFinish without separate component state.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.