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

[Chheckbox] Checkbox.Group 受控后,onChange 的回调值不对 #2923

Closed
moecasts opened this issue May 24, 2024 · 2 comments
Closed

[Chheckbox] Checkbox.Group 受控后,onChange 的回调值不对 #2923

moecasts opened this issue May 24, 2024 · 2 comments
Assignees
Labels
need more info 需要更多信息理解 issue 的问题

Comments

@moecasts
Copy link
Contributor

tdesign-react 版本

1.7.3

重现链接

https://stackblitz.com/edit/react-fq7yh3?file=src%2Fdemo.jsx

重现步骤

Checkbox.Group 值受控时,回调的结果不正确。
image

期望结果

受控的值与要变化的值进行计算。

实际结果

并未正确受控,现在点击后直接存进回调的值数组中了。

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

Copy link
Contributor

👋 @moecasts,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@moecasts moecasts changed the title [组件名称] 描述问题的标题 [Chheckbox] Checkbox.Group 受控后,onChange 的回调值不对 May 24, 2024
@NWYLZW
Copy link
Collaborator

NWYLZW commented May 25, 2024

const [v, setV] = useState([1])
<A value=v options=[1, 2, 3] onchange={() => {
  console.log(v)
}}/>

有三个选项

  • 1
  • 2 <- 现在选了它
  • 3
    如果按照你说的「受控的值与要变化的值进行计算。」那这里是不是要返回 1 呢?
    再具体描述一下你的操作步骤和你的预期行为?

@NWYLZW NWYLZW added the need more info 需要更多信息理解 issue 的问题 label May 25, 2024
@NWYLZW NWYLZW self-assigned this May 25, 2024
@NWYLZW NWYLZW closed this as completed May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info 需要更多信息理解 issue 的问题
Projects
None yet
Development

No branches or pull requests

2 participants