From 698792275abe03f31d920c6e937c614630427605 Mon Sep 17 00:00:00 2001 From: huan_kong <2564076459@qq.com> Date: Fri, 9 Feb 2024 01:39:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E8=B4=B4=E8=BE=B9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- theme/src/client/components/PostItem.vue | 6 ------ 1 file changed, 6 deletions(-) diff --git a/theme/src/client/components/PostItem.vue b/theme/src/client/components/PostItem.vue index 517919ce..e9cdef6a 100644 --- a/theme/src/client/components/PostItem.vue +++ b/theme/src/client/components/PostItem.vue @@ -139,12 +139,6 @@ const createTime = computed(() => } } -@media (min-width: 1200px) { - .post-item { - margin-left: 0; - } -} - .post-meta { display: flex; flex-wrap: wrap; From 91fc1357d3e3cc93c9a1d9b9c223d4ed5b1129e0 Mon Sep 17 00:00:00 2001 From: huan_kong <2564076459@qq.com> Date: Fri, 9 Feb 2024 01:43:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AF=B9=20`notes`=20=E4=B8=AD=20`sidebar`?= =?UTF-8?q?=20=E4=B8=BA=20`auto`=20=E6=97=B6=20=E8=87=AA=E5=8A=A8=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/node/prepareNotesData.ts | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/plugins/plugin-notes-data/src/node/prepareNotesData.ts b/plugins/plugin-notes-data/src/node/prepareNotesData.ts index 0f1379ac..ba611ae8 100644 --- a/plugins/plugin-notes-data/src/node/prepareNotesData.ts +++ b/plugins/plugin-notes-data/src/node/prepareNotesData.ts @@ -114,11 +114,29 @@ function initSidebarByAuto( note: NotesItemOptions, pages: NotePage[], ): NotesSidebarItem[] { - pages = pages.sort((prev, next) => { - const pi = prev.relativePath.match(/\//g)?.length || 0 - const ni = next.relativePath.match(/\//g)?.length || 0 - return pi < ni ? -1 : 1 + let tempPages = pages.map(page => { + return { ...page, splitPath: page.relativePath.split('/') } }) + + const maxIndex = Math.max(...tempPages.map(page => page.splitPath.length)) + let nowIndex = 0 + + while (nowIndex < maxIndex) { + tempPages = tempPages.sort((prev, next) => { + const pi = prev.splitPath?.[nowIndex]?.match(/(\d+)\.(?=[^/]+$)/)?.[1] + const ni = next.splitPath?.[nowIndex]?.match(/(\d+)\.(?=[^/]+$)/)?.[1] + if (!pi || !ni) return 0 + return parseFloat(pi) < parseFloat(ni) ? -1 : 1 + }) + + nowIndex++ + } + + pages = tempPages.map(page => { + delete page.splitPath; + return page + }) + const RE_INDEX = ['index.md', 'README.md', 'readme.md'] const result: NotesSidebarItem[] = [] for (const page of pages) {