From 5d508234739c537fac0aea4c8e9772322dc14acd Mon Sep 17 00:00:00 2001 From: hacxy Date: Wed, 25 Dec 2024 18:47:06 +0800 Subject: [PATCH 1/2] feat: the article list is sorted by time in descending order by default. --- package.json | 2 +- packages/demo/docs/src/demo2.md | 3 +- packages/demo/docs/src/demo4.md | 1 + .../theme/src/components/ArticlesList.vue | 21 +++---- packages/theme/src/datas/articles.data.ts | 56 +++++-------------- packages/theme/src/utils/common.ts | 25 +++++++++ packages/theme/src/utils/node/articles.ts | 16 ++++-- packages/theme/src/utils/node/date.ts | 8 +++ 8 files changed, 71 insertions(+), 61 deletions(-) create mode 100644 packages/theme/src/utils/common.ts diff --git a/package.json b/package.json index f60b4ec..2c2a846 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dev": "pnpm -F vitepress-theme-mild run dev", "build": "pnpm -F vitepress-theme-mild run build", "release": "pnpm -F vitepress-theme-mild run release", - "demo:dev": "pnpm -F demo run dev", + "demo:dev": "pnpm build && pnpm -F demo run dev", "demo:build": "pnpm -F demo run build", "demo:preview": "pnpm -F demo run preview", "prepare": "simple-git-hooks", diff --git a/packages/demo/docs/src/demo2.md b/packages/demo/docs/src/demo2.md index 36b1d56..8c51810 100644 --- a/packages/demo/docs/src/demo2.md +++ b/packages/demo/docs/src/demo2.md @@ -1,11 +1,12 @@ --- +date: 2024-12-25 17:25:00 category: 服务器 tags: - demo --- # demo2 - +测试时间 可以在 Markdown 文件、主题中的 \*.vue 组件、样式和普通的 .css 文件中引用静态资源,可以使用绝对路径 (基于项目根目录) 或者相对路径 (基于文件系统)。后者类似于 Vite、Vue CLI 或者 webpack 的 file-loader 的行为。 常见的图像,媒体和字体文件会被自动检测并视作资源。 diff --git a/packages/demo/docs/src/demo4.md b/packages/demo/docs/src/demo4.md index 7e9356b..39c9827 100644 --- a/packages/demo/docs/src/demo4.md +++ b/packages/demo/docs/src/demo4.md @@ -6,6 +6,7 @@ tags: --- # demo4 +这是demo4 测试时间 可以在 Markdown 文件、主题中的 \*.vue 组件、样式和普通的 .css 文件中引用静态资源,可以使用绝对路径 (基于项目根目录) 或者相对路径 (基于文件系统)。后者类似于 Vite、Vue CLI 或者 webpack 的 file-loader 的行为。 常见的图像,媒体和字体文件会被自动检测并视作资源。 diff --git a/packages/theme/src/components/ArticlesList.vue b/packages/theme/src/components/ArticlesList.vue index 0020734..29e66db 100644 --- a/packages/theme/src/components/ArticlesList.vue +++ b/packages/theme/src/components/ArticlesList.vue @@ -1,7 +1,7 @@