ant-design / ant-design/pro-components

🧐[问题] 自定义ProFormCheckbox

Open
#9,077 1 comment 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

### 🧐 问题描述

我想做个ProFormCheckBox button 但是没办法实现点击checkbox以外的地方改变其value
求大神帮忙

### 💻 示例代码

```
type ProFormCheckButtonProps = {
children: React.ReactNode
} & ProFormItemProps;

const ProFormCheckButton: React.FC = ({children, ...props}) => {
return (


{(itemProps) => {
console.log(itemProps)
return
}
>
{children}


}}


);
};

export default ProFormCheckButton;
```

### 🚑 其他信息

![Image](https://github.com/user-attachments/assets/22471c3a-07f0-4091-b09e-d0a552d8246a)

### 期望效果
可以和form联动,并且点击每个部位都可以改变其value

Contributor guide

Open the contributing guide

Research direction

Start from the supplied ProFormCheckButton example and inspect how ProForm.Item, FormControlRender, Button, and Checkbox propagate checked and change events. Reproduce the form interaction, then verify that clicking the button content or other non-checkbox areas updates the bound form value consistently.

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.