diff --git a/themes/heo/components/Header.js b/themes/heo/components/Header.js index 411cf070..f654d230 100644 --- a/themes/heo/components/Header.js +++ b/themes/heo/components/Header.js @@ -11,6 +11,7 @@ import throttle from 'lodash.throttle' const Header = props => { const [isOpen, changeShow] = useState(false) const [headerBgShow, setHeaderBgShow] = useState(false) + const [whiteTitle, setWhiteTitle] = useState(false) const toggleMenuOpen = () => { changeShow(!isOpen) @@ -33,18 +34,23 @@ const Header = props => { const scrollTrigger = useCallback(throttle(() => { const scrollS = window.scrollY const header = document.querySelector('#header') + const postHeader = document.querySelector('#post-bg') // 导航栏设置 白色背景 if (header && scrollS > 60) { setHeaderBgShow(true) + setWhiteTitle(false) } else { + if (postHeader) { + setWhiteTitle(true) + } setHeaderBgShow(false) } }, throttleMs)) return (<> {/* 头条 */} -