lijianan
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
6 deletions
-
components/back-top/index.tsx
|
|
@ -63,9 +63,9 @@ const BackTop: React.FC<BackTopProps> = props => { |
|
|
|
|
|
|
|
const handleScroll = throttleByAnimationFrame( |
|
|
|
(e: React.UIEvent<HTMLElement> | { target: any }) => { |
|
|
|
const { visibilityHeight } = props; |
|
|
|
const { visibilityHeight = 400 } = props; |
|
|
|
const scrollTop = getScroll(e.target, true); |
|
|
|
setVisible(scrollTop > visibilityHeight!); |
|
|
|
setVisible(scrollTop > visibilityHeight); |
|
|
|
}, |
|
|
|
); |
|
|
|
|
|
|
@ -131,8 +131,4 @@ const BackTop: React.FC<BackTopProps> = props => { |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
BackTop.defaultProps = { |
|
|
|
visibilityHeight: 400, |
|
|
|
}; |
|
|
|
|
|
|
|
export default React.memo(BackTop); |
|
|
|