From e51f794949ff7d7bbae4c8ddd44ab500fec3d260 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 26 Apr 2024 09:38:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?gitbook=20=E5=BB=B6=E6=97=B6=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E4=BE=A7=E8=BE=B9=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/gitbook/components/NavPostList.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/themes/gitbook/components/NavPostList.js b/themes/gitbook/components/NavPostList.js index 2c7fceffd68..be84e9badb7 100644 --- a/themes/gitbook/components/NavPostList.js +++ b/themes/gitbook/components/NavPostList.js @@ -61,10 +61,12 @@ const NavPostList = props => { // 如果都没有选中默认打开第一个 useEffect(() => { - if (expandedGroups.length === 0) { - setExpandedGroups([0]) - } - }, []) + setTimeout(() => { + if (expandedGroups.length === 0) { + setExpandedGroups([0]) + } + }, 500) + }, [router]) // 折叠项切换,当折叠或展开数组时会调用 const toggleItem = index => { From 3bb83c35576bf4d12f00e0e06eb12a6e6a4b2208 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 26 Apr 2024 09:38:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?starter=20=E9=A6=96=E9=A1=B5=E5=8D=9A?= =?UTF-8?q?=E5=AE=A2=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/starter/components/Blog.js | 117 +++++++++++++++--------------- 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/themes/starter/components/Blog.js b/themes/starter/components/Blog.js index 168c2984391..2dff9e8223a 100644 --- a/themes/starter/components/Blog.js +++ b/themes/starter/components/Blog.js @@ -1,8 +1,8 @@ /* eslint-disable @next/next/no-img-element */ import { siteConfig } from '@/lib/config' -import CONFIG from '../config' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' import Link from 'next/link' +import CONFIG from '../config' /** * 博文列表 @@ -10,71 +10,72 @@ import Link from 'next/link' * @returns */ export const Blog = ({ posts }) => { - return <> - {/* */} -
-
- {/* 区块标题文字 */} -
-
-
- - {siteConfig('STARTER_BLOG_TITLE', null, CONFIG)} - -

- {siteConfig('STARTER_BLOG_TEXT_1', null, CONFIG)} -

-

- -

-
-
+ return ( + <> + {/* */} +
+
+ {/* 区块标题文字 */} +
+
+
+ + {siteConfig('STARTER_BLOG_TITLE', null, CONFIG)} + +

+ {siteConfig('STARTER_BLOG_TEXT_1', null, CONFIG)} +

+

+
- {/* 博客列表 此处优先展示3片文章 */} -
- {posts?.map((item, index) => { - const url = checkContainHttp(item.slug) ? sliceUrlFromHttp(item.slug) : `${siteConfig('SUB_PATH', '')}/${item.slug}` - return
-
-
- +
+ {/* 博客列表 此处优先展示3片文章 */} +
+ {posts?.map((item, index) => { + const url = checkContainHttp(item.slug) + ? sliceUrlFromHttp(item.slug) + : `${siteConfig('SUB_PATH', '')}/${item.slug}` + return ( +
+
+
+ {item.title} - +
- + {item.publishDay} - -

- - {item.title} - -

-

- {item.summary} -

-
+ +

+ + {item.title} + +

+

+ {item.summary} +

+
- }) } -
+ ) + })} +
-
- {/* */} +
+ {/* */} + ) }