ant-design / ant-design/pro-components

🐛[BUG] Schema Form 自定义组件,通过 FormItemProps 设置 getValueProps,当属性名为自定义(即非 value)时,传参不生效

Open
#8,617 0 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

### 🐛 bug 描述

Schema Form 自定义组件,通过 FormItemProps 设置 getValueProps,当属性名为自定义(即非 value)时,传参不生效

### 📷 复现步骤

https://stackblitz.com/edit/react-ezg64m?file=App.tsx

![image](https://github.com/user-attachments/assets/57a9049e-2a35-4875-8280-4580bb23494c)
![image](https://github.com/user-attachments/assets/e06deec3-1ddc-4f8c-9cfa-384114387d67)
![image](https://github.com/user-attachments/assets/0b162979-22e5-4afd-9d6d-4adef4839af2)

如代码示例,只有 getValueProps 的属性名设置为默认的 `value` 时,才能够正常将 value 值传入自定义组件。若自定义属性名,则只能取到 undefined。

### 🏞 期望结果

自定义属性名也能够获取值。

### 💻 复现代码

如上。

### © 版本信息

"@ant-design/cssinjs": "^1.18.4",
"@ant-design/icons": "^5.2.6",
"@ant-design/pro-components": "^2.6.46",
"@ant-design/pro-layout": "^7.17.19",
"@ant-design/pro-table": "^3.13.14",
"@umijs/max": "^4.1.0",
"antd": "^5.13.1",

- 浏览器环境 Chrome 127.0.6533.74(正式版本) (x86_64)
- 开发环境 MacOS 14.5 (23F79)

### 🚑 其他信息

无。

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and its App.tsx example, then trace the Schema Form custom component and FormItemProps.getValueProps behavior. Confirm the difference between using the default value property and a custom property name. Done means the custom property receives the form value and the reproduction works as expected.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.