From b4bc31cf75c6424bae6a8b1e7cc3882a3acb88aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E4=BA=91=E8=8B=8D=E7=8B=97?= Date: Sat, 4 Nov 2023 17:44:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=84=20refactor:=20=E6=8B=86=E5=88=86?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/.vitepress/config.ts | 7 +++ demo/.vitepress/theme/index.ts | 2 + demo/.vitepress/theme/layout.vue | 11 ++++ .../components/TrmPageAbout.vue | 2 +- .../components/TrmPageArchive.vue | 6 +- .../components/TrmPageIndex.vue | 19 ++++--- .../components/TrmPageLinks.vue | 17 ++---- .../components/TrmPagePost.vue | 13 +++-- .../components/TrmSidebarUser.vue | 2 +- .../components/TrmTopBarLogo.vue | 2 +- .../{ => global}/TrmCardCategorie.vue | 8 +-- .../components/global/TrmCardLink.vue | 55 +++++++++++++++++++ .../components/{ => global}/TrmCardPost.vue | 26 +++++---- .../{ => global}/TrmCardPostMini.vue | 4 +- .../{ => global}/TrmDividerTitle.vue | 0 .../components/{ => global}/TrmSwichImgs.vue | 0 .../components/{ => global}/TrmTimeline.vue | 26 ++++++--- packages/vitepress-theme-async/index.ts | 16 +++++- packages/vitepress-theme-async/package.json | 9 +++ .../styles/_components/card.less | 34 ------------ .../styles/_components/index.less | 1 - .../styles/_components/plugins/index.less | 4 ++ .../{ => plugins}/publication.less | 43 --------------- .../vitepress-theme-async/types/index.d.ts | 16 +++++- 24 files changed, 181 insertions(+), 142 deletions(-) create mode 100644 demo/.vitepress/theme/layout.vue rename packages/vitepress-theme-async/components/{ => global}/TrmCardCategorie.vue (86%) create mode 100644 packages/vitepress-theme-async/components/global/TrmCardLink.vue rename packages/vitepress-theme-async/components/{ => global}/TrmCardPost.vue (87%) rename packages/vitepress-theme-async/components/{ => global}/TrmCardPostMini.vue (96%) rename packages/vitepress-theme-async/components/{ => global}/TrmDividerTitle.vue (100%) rename packages/vitepress-theme-async/components/{ => global}/TrmSwichImgs.vue (100%) rename packages/vitepress-theme-async/components/{ => global}/TrmTimeline.vue (81%) rename packages/vitepress-theme-async/styles/_components/{ => plugins}/publication.less (82%) diff --git a/demo/.vitepress/config.ts b/demo/.vitepress/config.ts index a3011ab..fc26831 100644 --- a/demo/.vitepress/config.ts +++ b/demo/.vitepress/config.ts @@ -19,6 +19,7 @@ export default defineConfig({ }, titleTemplate: ':title | Async', themeConfig: { + globalComponents: ['TrmDividerTitle'], topBars: [ { title: 'Home', url: '/' }, { @@ -109,5 +110,11 @@ export default defineConfig({ tags: '/tags', categorys: '/categories', }, + noticeOutdate: { + enable: true, + limitDay: 1, + style: 'flat', + position: 'bottom', + }, }, }); diff --git a/demo/.vitepress/theme/index.ts b/demo/.vitepress/theme/index.ts index f02feba..8be6b31 100644 --- a/demo/.vitepress/theme/index.ts +++ b/demo/.vitepress/theme/index.ts @@ -4,8 +4,10 @@ // }; import { defineTheme } from 'vitepress-theme-async'; +import layout from './layout.vue'; export default defineTheme({ + Layout: layout, enhanceApp(_ctx) { // }, diff --git a/demo/.vitepress/theme/layout.vue b/demo/.vitepress/theme/layout.vue new file mode 100644 index 0000000..f1385c9 --- /dev/null +++ b/demo/.vitepress/theme/layout.vue @@ -0,0 +1,11 @@ + + diff --git a/packages/vitepress-theme-async/components/TrmPageAbout.vue b/packages/vitepress-theme-async/components/TrmPageAbout.vue index 04ef5c9..48febe5 100644 --- a/packages/vitepress-theme-async/components/TrmPageAbout.vue +++ b/packages/vitepress-theme-async/components/TrmPageAbout.vue @@ -1,6 +1,6 @@ diff --git a/packages/vitepress-theme-async/components/TrmPageArchive.vue b/packages/vitepress-theme-async/components/TrmPageArchive.vue index e7da743..2cc4b81 100644 --- a/packages/vitepress-theme-async/components/TrmPageArchive.vue +++ b/packages/vitepress-theme-async/components/TrmPageArchive.vue @@ -2,9 +2,9 @@ import { computed, onMounted, ref } from "vue"; import { useTags, useArchives, useCategories, useAllPosts, useTheme } from "../composables"; +import TrmTimeline from "./global/TrmTimeline.vue"; +import TrmDividerTitle from "./global/TrmDividerTitle.vue"; import TrmPagination from "./TrmPagination.vue"; -import TrmTimeLine from "./TrmTimeline.vue"; -import TrmDividerTitle from "./TrmDividerTitle.vue"; import { formatDate } from "../utils/client"; import { useCurrentPageIndex } from "../blog"; @@ -80,7 +80,7 @@ onMounted(() => {
- +
diff --git a/packages/vitepress-theme-async/components/TrmPageIndex.vue b/packages/vitepress-theme-async/components/TrmPageIndex.vue index 42caa07..3be197e 100644 --- a/packages/vitepress-theme-async/components/TrmPageIndex.vue +++ b/packages/vitepress-theme-async/components/TrmPageIndex.vue @@ -1,17 +1,20 @@ @@ -38,17 +39,7 @@ const theme = useTheme(); diff --git a/packages/vitepress-theme-async/components/TrmPagePost.vue b/packages/vitepress-theme-async/components/TrmPagePost.vue index 0b3ca61..fa07952 100644 --- a/packages/vitepress-theme-async/components/TrmPagePost.vue +++ b/packages/vitepress-theme-async/components/TrmPagePost.vue @@ -1,10 +1,10 @@