feat:更新博客

This commit is contained in:
2025-11-29 21:49:12 +08:00
parent bda2256ea7
commit aa0603efff
15 changed files with 331 additions and 51 deletions

View File

@@ -20,9 +20,12 @@ export default defineConfig({
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Web前端', link: '/Web-Front/' },
{ text: 'Web后端', link: '/Web-Backend/' },
{ text: 'DevOps', link: '/DevOps/' },
{ text: 'SpringBoot', link: '/SpringBoot/' },
{ text: 'FastAPI', link: '/FastAPI/' },
{ text: 'Flutter', link: '/Flutter/' },
],
sidebar: {
'/Web-Backend/': [
@@ -57,6 +60,14 @@ export default defineConfig({
{ text: 'SpringBoot3原生镜像', link: '/SpringBoot/SpringBoot3-GraalVM' }
]
}
],
'/FastAPI/': [
{
text: 'FastAPI',
items: [
{ text: '基于OAuth2的FastApi安全验证', link: '/FastAPI/OAuth2' }
]
}
]
},
@@ -112,4 +123,8 @@ export default defineConfig({
},
lastUpdated: true,
markdown: {
lineNumbers: true
},
})

View File

@@ -1,12 +1,29 @@
import DefaultTheme from 'vitepress/theme'
import Confetti from "./components/Confetti.vue";
import type { EnhanceAppContext } from 'vitepress'
import { onMounted, watch, nextTick } from 'vue'
import { useRoute } from 'vitepress'
import mediumZoom from 'medium-zoom'
import '../theme/style.css'
import './style/var.css'
import './style/vp-code.css'
export default {
extends: DefaultTheme,
setup() {
const route = useRoute()
const initZoom = () => {
// 为所有图片增加缩放功能
mediumZoom('.main img', { background: 'var(--vp-c-bg)' })
}
onMounted(() => {
initZoom()
})
watch(
() => route.path,
() => nextTick(() => initZoom())
)
},
enhanceApp({ app }: EnhanceAppContext) {
app.component("Confetti", Confetti);
},

View File

@@ -1,19 +1,19 @@
@font-face {
font-family: 'CustomFont';
src: url('./fonts/custom.woff2') format('woff2');
font-weight: normal;
font-style: normal;
font-display: swap;
}
:root {
--vp-font-family-base: 'CustomFont', -apple-system, BlinkMacSystemFont,
'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
--vp-font-family-mono: 'CustomFont', 'Fira Code', 'Consolas', monospace;
'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
--vp-font-family-mono: 'CustomFont', Courier, monospace;
}
:root {
--vp-c-brand: #10b981;
--vp-c-brand-light: #34d399;
--vp-c-brand-lighter: #6ee7b7;
--vp-c-brand-dark: #059669;
--vp-c-brand-darker: #047857;
strong, b {
font-weight: bold;
font-synthesis: weight;
}

View File

@@ -37,3 +37,16 @@
filter: drop-shadow(-2px 4px 6px #0003);
padding: 18px;
}
.medium-zoom-overlay {
background-color: var(--vp-c-bg) !important;
z-index: 100;
}
.medium-zoom-overlay ~ img {
z-index: 101;
}
.medium-zoom--opened .medium-zoom-overlay {
opacity: 0.9 !important;
}

View File

@@ -0,0 +1,40 @@
/* 代码块:增加留空边距 增加阴影 */
.vp-doc div[class*=language-] {
box-shadow: 0 10px 15px 0 rgb(0 0 0 / 20%);
padding-top: 20px;
}
/* 代码块添加macOS风格的小圆点 */
.vp-doc div[class*=language-]::before {
content: "";
display: block;
position: absolute;
top: 12px;
left: 12px;
width: 12px;
height: 12px;
background-color: #ff5f56;
border-radius: 50%;
box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
z-index: 1;
}
/* 代码块:下移行号 隐藏右侧竖线 */
.vp-doc .line-numbers-wrapper {
padding-top: 40px;
border-right: none;
}
/* 代码块:重建行号右侧竖线 */
.vp-doc .line-numbers-wrapper::after {
content: "";
position: absolute;
top: 40px;
right: 0;
border-right: 1px solid var(--vp-code-block-divider-color);
height: calc(100% - 60px);
}
.vp-doc div[class*='language-'].line-numbers-mode {
margin-bottom: 20px;
}