mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-19 15:09:36 +00:00
折叠菜单
This commit is contained in:
@@ -58,17 +58,20 @@ const Collapse = props => {
|
||||
clearTimeout(clearTime)
|
||||
}
|
||||
|
||||
const updateHeight = () => {
|
||||
collapseRef.current.style.height = 'auto'
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
const element = collapseRef.current
|
||||
if (props.isOpen) {
|
||||
expandSection(element)
|
||||
expandSection(collapseRef.current)
|
||||
} else {
|
||||
collapseSection(element)
|
||||
collapseSection(collapseRef.current)
|
||||
}
|
||||
}, [props.isOpen])
|
||||
|
||||
return (
|
||||
<div ref={collapseRef} style={type === 'vertical' ? { height: '0px' } : { width: '0px' }} className={'overflow-hidden duration-200 ' + props.className }>
|
||||
<div ref={collapseRef} onClick={updateHeight} style={type === 'vertical' ? { height: '0px' } : { width: '0px' }} className={'overflow-hidden duration-200 ' + props.className }>
|
||||
{props.children}
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user