From 4f267faa2ba94346c1aeb86d817733f9e306cef6 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 22 Apr 2025 15:05:08 +0800 Subject: [PATCH] docs: add aside outline nav --- docs/.vuepress/client.ts | 16 ++-- docs/.vuepress/config.ts | 6 ++ docs/.vuepress/themes/components/AsideNav.vue | 79 +++++++++++++++++++ docs/README.md | 4 + docs/demos.md | 4 + docs/tsconfig.json | 19 +++++ 6 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 docs/.vuepress/themes/components/AsideNav.vue create mode 100644 docs/tsconfig.json diff --git a/docs/.vuepress/client.ts b/docs/.vuepress/client.ts index 2d6722ab..1aa5976f 100644 --- a/docs/.vuepress/client.ts +++ b/docs/.vuepress/client.ts @@ -1,14 +1,16 @@ +import { h } from 'vue' +import { Layout } from 'vuepress-theme-plume/client' import { defineClientConfig } from 'vuepress/client' -import Contributors from './themes/components/Contributors.vue' -import Demos from './themes/components/Demos.vue' -import { setupThemeColors } from './themes/composables/theme-colors.js' +import AsideNav from '~/components/AsideNav.vue' +import { setupThemeColors } from '~/composables/theme-colors.js' export default defineClientConfig({ - enhance({ app }) { - app.component('Demos', Demos) - app.component('Contributors', Contributors) - }, setup() { setupThemeColors() }, + layouts: { + Layout: h(Layout, null, { + 'aside-outline-after': () => h(AsideNav), + }), + }, }) diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 40ff47b6..ab31a700 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -36,6 +36,12 @@ export default defineUserConfig({ __VUEPRESS_VERSION__: vuepress, }, + alias: { + '~/theme': path.resolve(__dirname, './themes'), + '~/components': path.resolve(__dirname, './themes/components'), + '~/composables': path.resolve(__dirname, './themes/composables'), + }, + bundler: viteBundler(), shouldPrefetch: false, diff --git a/docs/.vuepress/themes/components/AsideNav.vue b/docs/.vuepress/themes/components/AsideNav.vue new file mode 100644 index 00000000..60f69a96 --- /dev/null +++ b/docs/.vuepress/themes/components/AsideNav.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/docs/README.md b/docs/README.md index 05af11f5..305ba15f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -179,3 +179,7 @@ npm run docs:dev cursor: default !important; } + + diff --git a/docs/demos.md b/docs/demos.md index d736e246..f338a58e 100644 --- a/docs/demos.md +++ b/docs/demos.md @@ -182,3 +182,7 @@ blog: ## 博客 + + diff --git a/docs/tsconfig.json b/docs/tsconfig.json new file mode 100644 index 00000000..d29be14a --- /dev/null +++ b/docs/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "~/themes/*": ["./.vuepress/themes/*"], + "~/components/*": ["./.vuepress/themes/components/*"], + "~/composables/*": ["./.vuepress/themes/composables/*"] + } + }, + "include": [ + "./.vuepress/**/*" + ], + "exclude": [ + "./.vuepress/.cache", + "./.vuepress/.temp", + "./.vuepress/dist" + ] +}