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

[Popup] 在受控情况下,如何方便的实现点击Popup外部关闭Popup #3341

Open
2ue opened this issue Jan 22, 2025 · 2 comments
Open

Comments

@2ue
Copy link
Contributor

2ue commented Jan 22, 2025

这个功能解决了什么问题

在设置了visible属性后,组件变为受控组件,这时想要实现“点击Popup外部关闭Popup”不够方便,要么手搓js监听事件来改变visible值;当然社区也有提供一些方案,方便处理该问题,比如react-cool-onclickoutside,但受限于Popup没有接收ref属性,导致无法实现该功能。

你建议的方案是什么

建议方案一:
增加一个事件onClickOut,在点击Popup之外的元素触发

建议方案二:
接收外部传入的ref属性,使其可以使用社区方案快速实现

Copy link
Contributor

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

@huangchen1031
Copy link
Collaborator

onVisibleChange就可以了吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants