fix: 💨

This commit is contained in:
codytseng 2025-08-23 23:21:57 +08:00
parent a9caf9d5ad
commit ad3df9b037
4 changed files with 18 additions and 14 deletions

View file

@ -31,11 +31,13 @@ const PrimaryPageLayout = forwardRef(
useImperativeHandle(
ref,
() => ({
scrollToTop: () => {
if (scrollAreaRef.current) {
return scrollAreaRef.current.scrollTo({ top: 0, behavior: 'smooth' })
}
window.scrollTo({ top: 0, behavior: 'smooth' })
scrollToTop: (behavior: ScrollBehavior = 'smooth') => {
setTimeout(() => {
if (scrollAreaRef.current) {
return scrollAreaRef.current.scrollTo({ top: 0, behavior })
}
window.scrollTo({ top: 0, behavior })
}, 10)
}
}),
[]