From e499ccb3a6729e26071a4be05d8c93d99dc2c2f3 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 4 Jun 2024 09:45:30 +0800 Subject: [PATCH] =?UTF-8?q?gitbook=20=E4=BA=BF=E7=82=B9=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/gitbook/components/CatalogDrawerWrapper.js | 6 ++++++ themes/gitbook/components/PageNavDrawer.js | 8 +++++++- themes/gitbook/index.js | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/themes/gitbook/components/CatalogDrawerWrapper.js b/themes/gitbook/components/CatalogDrawerWrapper.js index 3b6ee8da..c978ee15 100644 --- a/themes/gitbook/components/CatalogDrawerWrapper.js +++ b/themes/gitbook/components/CatalogDrawerWrapper.js @@ -1,5 +1,7 @@ import { useGlobal } from '@/lib/global' import { useGitBookGlobal } from '@/themes/gitbook' +import { useRouter } from 'next/router' +import { useEffect } from 'react' import Catalog from './Catalog' /** @@ -12,9 +14,13 @@ import Catalog from './Catalog' const CatalogDrawerWrapper = ({ post, cRef }) => { const { tocVisible, changeTocVisible } = useGitBookGlobal() const { locale } = useGlobal() + const router = useRouter() const switchVisible = () => { changeTocVisible(!tocVisible) } + useEffect(() => { + changeTocVisible(false) + }, [router]) return ( <>
{ const { pageNavVisible, changePageNavVisible } = useGitBookGlobal() const { filteredNavPages } = props const { locale } = useGlobal() - + const router = useRouter() const switchVisible = () => { changePageNavVisible(!pageNavVisible) } + useEffect(() => { + changePageNavVisible(false) + }, [router]) + return ( <>
{ )} - {/* 移动端底部按钮 */} + {/* 移动端底部导航按钮 */}