diff --git a/components/JumpToTop.js b/components/JumpToTop.js index 3dfcd209..4ead6b10 100644 --- a/components/JumpToTop.js +++ b/components/JumpToTop.js @@ -16,7 +16,7 @@ const JumpToTop = ({ targetRef, showPercent = true }) => { const [percent, changePercent] = useState(0) const scrollListener = useCallback(throttle(() => { // 处理是否显示回到顶部按钮 - const clientHeight = targetRef ? (targetRef.current.clientHeight) : 0 + const clientHeight = targetRef ? (targetRef.current ? targetRef.current.clientHeight : 0) : 0 const scrollY = window.pageYOffset const fullHeight = clientHeight - window.outerHeight const shouldShow = scrollY > 100 diff --git a/components/MenuButtonGroup.js b/components/MenuButtonGroup.js index 37100c01..cf349c2e 100644 --- a/components/MenuButtonGroup.js +++ b/components/MenuButtonGroup.js @@ -29,7 +29,7 @@ const MenuButtonGroup = ({ allowCollapse = false }) => {