From a95f624fa2b57dbd19d133d3dffe9eb3c19a7273 Mon Sep 17 00:00:00 2001 From: Rhen Cloud Date: Mon, 29 Dec 2025 00:15:20 +0800 Subject: [PATCH] update --- app/app.vue | 1 + app/assets/css/main.css | 108 +++++++++++- app/components/blog/Header.vue | 7 +- app/components/blog/Toc.vue | 75 +++++++-- app/components/blog/card.vue | 17 +- app/components/content/ProseCode.vue | 2 +- app/components/content/ProsePre.vue | 158 +++++++++++------- app/components/main/SocialLinks.vue | 2 +- app/components/main/TechInfo.vue | 9 +- app/components/main/footer.vue | 1 - app/components/main/header.vue | 40 +++-- app/components/main/hero.vue | 5 +- app/components/main/recent.vue | 11 +- app/config/index.ts | 1 + app/pages/blogs/[blog].vue | 3 +- app/pages/index.vue | 1 - app/pages/tags/[tag].vue | 10 +- app/pages/tags/index.vue | 8 +- app/utils/helper.ts | 8 +- bun.lock | 158 ++++++------------ .../configure-fish-on-windows copy/index.md | 28 ++-- .../blogs/configure-fish-on-windows/index.md | 30 ++-- nuxt.config.ts | 10 +- package.json | 2 + 24 files changed, 405 insertions(+), 290 deletions(-) diff --git a/app/app.vue b/app/app.vue index 1f2b208..24542da 100644 --- a/app/app.vue +++ b/app/app.vue @@ -29,6 +29,7 @@ const bgStyle = computed(() => +
-import { formatDate } from "~/utils/helper"; interface Props { title?: string; image?: string; @@ -26,7 +25,7 @@ withDefaults(defineProps(), {
- {{ formatDate(date) }} + {{ date }}
diff --git a/app/components/blog/Toc.vue b/app/components/blog/Toc.vue index 9c6bf09..186443f 100644 --- a/app/components/blog/Toc.vue +++ b/app/components/blog/Toc.vue @@ -2,10 +2,27 @@ const { path } = useRoute(); const articles = await queryCollection("content").path(path).first(); -const links = articles?.body?.toc?.links || []; +interface TocLink { + id: string; + text: string; + children?: TocLink[]; +} + +const links = (articles?.body?.toc?.links || []) as TocLink[]; const activeId = ref(""); +const flattenLinks = (links: TocLink[]) => { + let flat: TocLink[] = []; + links.forEach((link) => { + flat.push(link); + if (link.children) { + flat = flat.concat(flattenLinks(link.children)); + } + }); + return flat; +}; + onMounted(() => { const observer = new IntersectionObserver( (entries) => { @@ -18,7 +35,7 @@ onMounted(() => { { rootMargin: "-100px 0% -80% 0%" }, ); - links.forEach((link) => { + flattenLinks(links).forEach((link) => { const el = document.getElementById(link.id); if (el) observer.observe(el); }); @@ -37,18 +54,48 @@ onMounted(() => { Table Of Content
diff --git a/app/components/blog/card.vue b/app/components/blog/card.vue index 8723d4d..53300b7 100644 --- a/app/components/blog/card.vue +++ b/app/components/blog/card.vue @@ -1,14 +1,13 @@ diff --git a/app/components/main/SocialLinks.vue b/app/components/main/SocialLinks.vue index ecffa95..54b829f 100644 --- a/app/components/main/SocialLinks.vue +++ b/app/components/main/SocialLinks.vue @@ -4,7 +4,7 @@