Skip to content

Commit 4302f9e

Browse files
committed
WIP 13
* Add medium-zoom
1 parent 33a648a commit 4302f9e

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

docs/.vitepress/theme/index.mts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
import DefaultTheme from 'vitepress/theme'
2+
3+
/* mediumZoom */
4+
import mediumZoom from 'medium-zoom';
5+
import { onMounted, watch, nextTick } from 'vue';
6+
import { useRoute } from 'vitepress';
7+
28
import './style/index.css'
39

410
export default {
511
extends: DefaultTheme,
12+
13+
/* mediumZoom */
14+
setup() {
15+
const route = useRoute();
16+
const initZoom = () => {
17+
mediumZoom('.main img', { background: 'var(--vp-c-bg)' });
18+
};
19+
onMounted(() => {
20+
initZoom();
21+
});
22+
watch(
23+
() => route.path,
24+
() => nextTick(() => initZoom())
25+
);
26+
},
27+
628
}

docs/.vitepress/theme/style/var.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
/* hero logo 背景颜色 */
2121
--vp-home-hero-image-background-image: linear-gradient(var(--miuix-color-primary), var(--miuix-color-primary));
2222
--vp-home-hero-image-filter: blur(40px);
23-
2423
}
2524

2625
/* 深色模式主题色 */
@@ -34,4 +33,13 @@
3433
background-clip: text;
3534
-webkit-background-clip: text;
3635
-webkit-text-fill-color: transparent;
37-
}
36+
}
37+
38+
/* mediumZoom 样式 */
39+
.medium-zoom-overlay {
40+
z-index: 30;
41+
}
42+
43+
.medium-zoom-image {
44+
z-index: 9999 !important;
45+
}

docs/package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
"docs:dev": "vitepress dev --host",
77
"docs:build": "vitepress build",
88
"docs:preview": "vitepress preview"
9+
},
10+
"dependencies": {
11+
"medium-zoom": "^1.1.0"
912
}
10-
}
13+
}

0 commit comments

Comments
 (0)