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

希望useClickAway的target可以支持css的selector选择器 #2637

Open
whaleluo opened this issue Sep 3, 2024 · 1 comment
Open

希望useClickAway的target可以支持css的selector选择器 #2637

whaleluo opened this issue Sep 3, 2024 · 1 comment
Labels
feature New feature or request

Comments

@whaleluo
Copy link

whaleluo commented Sep 3, 2024

目前useClickAway必须存在一个已渲染完成的dom作为target,但有时候target是动态创建的,不知道什么时候才渲染ok, 但当有点击事件的时候再去判断点击事件是否在指定选择器内部

@crazylxr
Copy link
Collaborator

crazylxr commented Sep 13, 2024

支持 CSS 不太现实,如果传入选择器的话,是无法感知到 target 发生变化的,这样就无法计算应该绑定的事件。

我是建议 target 支持传函数,返回值是 Element,类型是这样 (() => Element),这样的话你可以在函数里面通过 css 选择器查询 DOM,这样更通用一些

@crazylxr crazylxr added the feature New feature or request label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants