Skip to content

Commit dbd83a0

Browse files
committed
docs: update readme and add theme configuration guide
1 parent bc37a01 commit dbd83a0

File tree

2 files changed

+142
-1
lines changed

2 files changed

+142
-1
lines changed

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
home: true
3-
heroImage: https://vuepress.vuejs.org/images/hero.png
3+
heroImage: https://vuepress.vuejs.org/images/Thriller.A.Cruel.Picture.1973.1080p.BluRay.x264.AAC-[YTS.MX].mp4_20250708_231307.749
44
heroText: MatrixCQY
55
tagline: 记录数学、代码与金融学习心得
66
actions:

docs/theme-guide.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# VuePress 主题设置教程
2+
3+
本文档介绍如何自定义 VuePress 的默认主题(Default Theme)。所有配置均位于 `docs/.vuepress/config.js` 文件中。
4+
5+
## 1. 配置文件结构
6+
7+
打开 `docs/.vuepress/config.js`,你会看到类似如下的结构:
8+
9+
```javascript
10+
import { defaultTheme } from '@vuepress/theme-default'
11+
12+
export default defineUserConfig({
13+
theme: defaultTheme({
14+
// 主题配置项在这里
15+
}),
16+
})
17+
```
18+
19+
## 2. 常用配置项
20+
21+
### 2.1 导航栏 (Navbar)
22+
23+
导航栏位于页面顶部,用于全局导航。
24+
25+
```javascript
26+
navbar: [
27+
// 字符串 - 页面文件路径
28+
'/guide/README.md',
29+
30+
// 对象 - 包含 text 和 link
31+
{
32+
text: '首页',
33+
link: '/',
34+
},
35+
36+
// 嵌套组 - 下拉菜单
37+
{
38+
text: '笔记分类',
39+
children: [
40+
{ text: '数学', link: '/math/' },
41+
{ text: '代码', link: '/code/' },
42+
],
43+
},
44+
45+
// 外部链接
46+
{
47+
text: 'GitHub',
48+
link: 'https://github.com/MatrixCQY',
49+
},
50+
],
51+
```
52+
53+
### 2.2 侧边栏 (Sidebar)
54+
55+
侧边栏用于页面内的导航。
56+
57+
```javascript
58+
sidebar: {
59+
// 不同路径显示不同侧边栏
60+
'/math/': [
61+
{
62+
text: '数学笔记',
63+
collapsible: true, // 是否可折叠
64+
children: [
65+
'/math/complex-analysis/complex-numbers.md',
66+
// ...
67+
],
68+
},
69+
],
70+
'/code/': [
71+
// ...
72+
],
73+
},
74+
```
75+
76+
### 2.3 颜色模式 (Color Mode)
77+
78+
默认支持浅色和深色模式切换。
79+
80+
```javascript
81+
// 默认颜色模式: 'auto' | 'light' | 'dark'
82+
colorMode: 'auto',
83+
84+
// 是否显示颜色模式切换按钮
85+
colorModeSwitch: true,
86+
```
87+
88+
### 2.4 Logo 与 仓库链接
89+
90+
```javascript
91+
// 左上角 Logo (需放在 docs/.vuepress/public 目录下)
92+
logo: '/images/logo.png',
93+
94+
// 黑暗模式下的 Logo
95+
logoDark: '/images/logo-dark.png',
96+
97+
// 仓库链接 (显示在导航栏右侧)
98+
repo: 'MatrixCQY/bbblog',
99+
repoLabel: 'GitHub',
100+
```
101+
102+
## 3. 首页配置 (Home Page)
103+
104+
首页内容在 `docs/README.md` 的 Frontmatter 中配置:
105+
106+
```yaml
107+
---
108+
home: true
109+
heroImage: /images/hero.png
110+
heroText: 博客标题
111+
tagline: 博客副标题
112+
actions:
113+
- text: 快速开始
114+
link: /guide/
115+
type: primary
116+
features:
117+
- title: 特性1
118+
details: 详细描述...
119+
- title: 特性2
120+
details: 详细描述...
121+
---
122+
```
123+
124+
## 4. 自定义样式
125+
126+
如果需要修改 CSS 样式,可以创建或编辑 `docs/.vuepress/styles/index.scss` 文件。
127+
128+
```scss
129+
/* 示例:修改侧边栏宽度 */
130+
:root {
131+
--sidebar-width: 20rem;
132+
}
133+
134+
/* 示例:修改强调色 */
135+
:root {
136+
--c-brand: #3eaf7c;
137+
--c-brand-light: #4abf8a;
138+
}
139+
```
140+
141+
更多详细配置请参考 [VuePress 官方文档](https://v2.vuepress.vuejs.org/zh/reference/default-theme/config.html)

0 commit comments

Comments
 (0)