Skip to content

Commit 1dac257

Browse files
committed
✨feat: 添加导航毛玻璃效果
路由切换不再使用废弃的‘router.onAfterRouteChanged’,改为‘router.onAfterRouteChange’
1 parent c51c546 commit 1dac257

3 files changed

Lines changed: 43 additions & 1 deletion

File tree

docs/.vitepress/theme/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default {
5151
router.onBeforeRouteChange = () => {
5252
NProgress.start() // 开始进度条
5353
}
54-
router.onAfterRouteChanged = () => {
54+
router.onAfterRouteChange = () => {
5555
NProgress.done() // 停止进度条
5656
}
5757
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* .vitepress\theme\style\blur.css */
2+
:root {
3+
/* 首页下滑后导航透明 */
4+
.VPNavBar:not(.has-sidebar):not(.home.top) {
5+
background-color: rgba(255, 255, 255, 0);
6+
backdrop-filter: blur(10px);
7+
}
8+
9+
/* 搜索框透明 */
10+
.DocSearch-Button {
11+
background-color: rgba(255, 255, 255, 0);
12+
backdrop-filter: blur(10px);
13+
}
14+
15+
/* Feature透明 */
16+
.VPFeature {
17+
border: none;
18+
box-shadow: 0 10px 30px 0 rgb(0 0 0 / 15%);
19+
background-color: transparent;
20+
}
21+
22+
/* 文档页侧边栏顶部透明 */
23+
.curtain {
24+
background-color: rgba(255, 255, 255, 0);
25+
backdrop-filter: blur(10px);
26+
}
27+
28+
@media (min-width: 960px) {
29+
/* 文档页导航中间透明 */
30+
.VPNavBar:not(.home.top) .content-body {
31+
background-color: rgba(255, 255, 255, 0);
32+
backdrop-filter: blur(10px);
33+
}
34+
}
35+
36+
/* 移动端大纲栏透明 */
37+
.VPLocalNav {
38+
background-color: rgba(255, 255, 255, 0);
39+
backdrop-filter: blur(10px);
40+
}
41+
}

docs/.vitepress/theme/style/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
@import "./vp-code.css";
33
@import "./vp-code-group.css";
44
@import "./rainbow.scss";
5+
@import "./blur.css";

0 commit comments

Comments
 (0)