From 802ecf6e9e80cd43f94217e52dae8ed7048aa2b1 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Fri, 23 Sep 2022 16:11:52 +0800 Subject: [PATCH] style: code optimization (#37718) --- components/back-top/index.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index 81093f2549..99651d0d87 100644 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -63,9 +63,9 @@ const BackTop: React.FC = props => { const handleScroll = throttleByAnimationFrame( (e: React.UIEvent | { 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 = props => { ); }; -BackTop.defaultProps = { - visibilityHeight: 400, -}; - export default React.memo(BackTop);