@@ -39,10 +54,10 @@ function toggle() {
{{ item.text }}
@@ -66,6 +81,7 @@ function toggle() {
From 8607fe1cb0a91813d701c0d00312855f4d20c942 Mon Sep 17 00:00:00 2001
From: LittleSound <464388324@qq.com>
Date: Thu, 22 Sep 2022 22:12:58 +0800
Subject: [PATCH 4/7] fix: lint error
---
docs/.vitepress/config.ts | 39 +++++++++++++++++++++++++++++++++++++--
types/default-theme.d.ts | 36 ++++++++++++++++++------------------
2 files changed, 55 insertions(+), 20 deletions(-)
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index a24c1be1f109..1bfaea06308b 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -78,8 +78,43 @@ function sidebarGuide() {
items: [
{ text: 'What is VitePress?', link: '/guide/what-is-vitepress' },
{ text: 'Getting Started', link: '/guide/getting-started' },
- { text: 'Configuration', link: '/guide/configuration' },
- { text: 'Deploying', link: '/guide/deploying' }
+ {
+ text: 'Configuration',
+ link: '/guide/configuration',
+ collapsible: true,
+ collapsed: true,
+ items: [
+ { text: 'What is VitePress?', link: '/guide/what-is-vitepress' },
+ { text: 'Getting Started', link: '/guide/getting-started' },
+ { text: 'Configuration', link: '/guide/configuration' },
+ { text: 'Deploying', link: '/guide/deploying' }
+ ]
+ },
+ {
+ text: 'Deploying',
+ collapsible: true,
+ collapsed: true,
+ items: [
+ { text: 'What is VitePress?', link: '/guide/what-is-vitepress' },
+ { text: 'Getting Started', link: '/guide/getting-started' },
+ { text: 'Configuration', link: '/guide/configuration' },
+ {
+ text: 'Deploying',
+ link: '/guide/deploying',
+ collapsible: true,
+ collapsed: true,
+ items: [
+ {
+ text: 'What is VitePress?',
+ link: '/guide/what-is-vitepress'
+ },
+ { text: 'Getting Started', link: '/guide/getting-started' },
+ { text: 'Configuration', link: '/guide/configuration' },
+ { text: 'Deploying', link: '/guide/deploying' }
+ ]
+ }
+ ]
+ }
]
},
{
diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts
index e5dc5981d3c7..7338ca034d86 100644
--- a/types/default-theme.d.ts
+++ b/types/default-theme.d.ts
@@ -149,24 +149,24 @@ export namespace DefaultTheme {
export type SidebarItem =
| { text: string; link: string }
| {
- text: string;
- link?: string;
- items: SidebarItem[];
-
- /**
- * If `true`, toggle button is shown.
- *
- * @default false
- */
- collapsible?: boolean
-
- /**
- * If `true`, collapsible group is collapsed by default.
- *
- * @default false
- */
- collapsed?: boolean
- }
+ text: string
+ link?: string
+ items: SidebarItem[]
+
+ /**
+ * If `true`, toggle button is shown.
+ *
+ * @default false
+ */
+ collapsible?: boolean
+
+ /**
+ * If `true`, collapsible group is collapsed by default.
+ *
+ * @default false
+ */
+ collapsed?: boolean
+ }
// edit link -----------------------------------------------------------------
From d45f2ca816ef03b928ea7865364deb8c651f6f04 Mon Sep 17 00:00:00 2001
From: LittleSound <464388324@qq.com>
Date: Thu, 22 Sep 2022 22:19:59 +0800
Subject: [PATCH 5/7] chore: remove the config.ts modification 2
---
docs/.vitepress/config.ts | 39 ++-------------------------------------
1 file changed, 2 insertions(+), 37 deletions(-)
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 1bfaea06308b..a24c1be1f109 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -78,43 +78,8 @@ function sidebarGuide() {
items: [
{ text: 'What is VitePress?', link: '/guide/what-is-vitepress' },
{ text: 'Getting Started', link: '/guide/getting-started' },
- {
- text: 'Configuration',
- link: '/guide/configuration',
- collapsible: true,
- collapsed: true,
- items: [
- { text: 'What is VitePress?', link: '/guide/what-is-vitepress' },
- { text: 'Getting Started', link: '/guide/getting-started' },
- { text: 'Configuration', link: '/guide/configuration' },
- { text: 'Deploying', link: '/guide/deploying' }
- ]
- },
- {
- text: 'Deploying',
- collapsible: true,
- collapsed: true,
- items: [
- { text: 'What is VitePress?', link: '/guide/what-is-vitepress' },
- { text: 'Getting Started', link: '/guide/getting-started' },
- { text: 'Configuration', link: '/guide/configuration' },
- {
- text: 'Deploying',
- link: '/guide/deploying',
- collapsible: true,
- collapsed: true,
- items: [
- {
- text: 'What is VitePress?',
- link: '/guide/what-is-vitepress'
- },
- { text: 'Getting Started', link: '/guide/getting-started' },
- { text: 'Configuration', link: '/guide/configuration' },
- { text: 'Deploying', link: '/guide/deploying' }
- ]
- }
- ]
- }
+ { text: 'Configuration', link: '/guide/configuration' },
+ { text: 'Deploying', link: '/guide/deploying' }
]
},
{
From 5cbd0d9c96306da168087f66df6eb3fcfedad0a2 Mon Sep 17 00:00:00 2001
From: LittleSound <464388324@qq.com>
Date: Sun, 2 Oct 2022 20:34:16 +0800
Subject: [PATCH 6/7] fix: sidebar will be closed when switching drawer state
on mobile
---
src/client/theme-default/components/VPSidebarLink.vue | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/client/theme-default/components/VPSidebarLink.vue b/src/client/theme-default/components/VPSidebarLink.vue
index 5ce7b74156ac..93cc00789bdd 100644
--- a/src/client/theme-default/components/VPSidebarLink.vue
+++ b/src/client/theme-default/components/VPSidebarLink.vue
@@ -40,12 +40,11 @@ function toggle() {
}
function clickLink() {
- closeSideBar()
-
// If there are no links to jump to, switch to expand when clicking on the text
- if (!props.item.link) {
+ if (!props.item.link)
toggle()
- }
+ else
+ closeSideBar()
}
From c39fdff0ce0e9793a41e27b5dda0afe279d58e7b Mon Sep 17 00:00:00 2001
From: LittleSound <464388324@qq.com>
Date: Sat, 29 Oct 2022 17:40:03 +0800
Subject: [PATCH 7/7] feat: Automatically unfold active routes
---
.../components/VPSidebarGroup.vue | 11 +----------
.../theme-default/components/VPSidebarLink.vue | 18 ++++++++++++++++--
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/client/theme-default/components/VPSidebarGroup.vue b/src/client/theme-default/components/VPSidebarGroup.vue
index 701453733f05..1c44569d7286 100644
--- a/src/client/theme-default/components/VPSidebarGroup.vue
+++ b/src/client/theme-default/components/VPSidebarGroup.vue
@@ -1,8 +1,6 @@