Browse Source

style: code optimization (#37718)

pull/37724/head
lijianan 2 years ago
committed by GitHub
parent
commit
802ecf6e9e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      components/back-top/index.tsx

8
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);

Loading…
Cancel
Save