Skip to content

Card的onHeaderClick不能调组件吗 #5240

Answered by GOWxx
githubqh asked this question in Q&A
Discussion options

You must be logged in to vote
type CardProps = {
    onHeaderClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void
}

可以看到 onHeaderClick 方法里 return 并不会有什么作用
如果是想在本页面渲染浮动页面或组件,可以看看 Modal Popup 或者别的符合需求的组件
如果没有符合需求的话,可以考虑自己写个组件,onHeaderClick 方法里改变变量控制该组件的显示隐藏状态

在你的 demo 上加了 Popup
https://codesandbox.io/s/happy-thompson-fk7hdk?file=/src/App.tsx

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@githubqh
Comment options

Comment options

You must be logged in to vote
2 replies
@githubqh
Comment options

@githubqh
Comment options

Answer selected by awmleer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #5239 on May 26, 2022 06:47.