fix: 🐛

This commit is contained in:
codytseng
2024-12-03 23:01:59 +08:00
parent d756d8fc2f
commit dd1fd83045

View File

@@ -30,12 +30,14 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode
useEffect(() => {
const handleScroll = () => {
const scrollTop = scrollAreaRef.current?.scrollTop || 0
if (scrollTop > lastScrollTop) {
const diff = scrollTop - lastScrollTop
if (diff > 20) {
setVisible(false)
} else {
setLastScrollTop(scrollTop)
} else if (diff < -20) {
setVisible(true)
setLastScrollTop(scrollTop)
}
setLastScrollTop(scrollTop)
}
const scrollArea = scrollAreaRef.current