Tencent / Tencent/tdesign-react
[Form] FormItem 劫持第一层受控组件的逻辑,是否可以优化成有 name 字段的时候才劫持
Open
Nobody has claimed this yet.
💭 discussion
- Dominant language
- TypeScript
- Stars
- 965
- Forks
- 373
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 17
Description
这个功能解决了什么问题
明确了 Form.Item 是否要劫持第一层组件的 value 和 onChange,不需要写额外多一个无意义的 <div>
现在 FAQ 里面的前两点,看上去都是同一个问题
你建议的方案是什么
当 FormItem 不存在 name 属性的时候,不进行劫持,因为此时没有对应的 form keyName 可用于收集。
当 FormItem 存在 name 属性的时候,才自动劫持第一层的 value,维持当前逻辑。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Form.Item handling for the first child component and compare it with the FAQ examples referenced in the issue. Verify the existing value and onChange behavior when name is present, then confirm that components without name are no longer handled while named fields retain the current behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100