docs: 支持点击放大文档中的图片 (#149)
This commit is contained in:
7
docs/.vitepress/theme/index.css
Normal file
7
docs/.vitepress/theme/index.css
Normal file
@@ -0,0 +1,7 @@
|
||||
.medium-zoom-overlay {
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.medium-zoom-image--opened {
|
||||
z-index: 31;
|
||||
}
|
||||
22
docs/.vitepress/theme/index.ts
Normal file
22
docs/.vitepress/theme/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import DefaultTheme from "vitepress/theme";
|
||||
import { onMounted, watch, nextTick } from "vue";
|
||||
import { useRoute } from "vitepress";
|
||||
import mediumZoom from "medium-zoom";
|
||||
import "./index.css";
|
||||
|
||||
export default {
|
||||
...DefaultTheme,
|
||||
setup() {
|
||||
const route = useRoute();
|
||||
const initZoom = () => {
|
||||
mediumZoom(".main img", { background: "var(--vp-c-bg)" });
|
||||
};
|
||||
onMounted(() => {
|
||||
initZoom();
|
||||
});
|
||||
watch(
|
||||
() => route.path,
|
||||
() => nextTick(() => initZoom()),
|
||||
);
|
||||
},
|
||||
};
|
||||
BIN
docs/bun.lockb
BIN
docs/bun.lockb
Binary file not shown.
@@ -2,6 +2,7 @@
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"markdown-it-task-lists": "^2.1.1",
|
||||
"medium-zoom": "^1.1.0",
|
||||
"vitepress": "^1.2.3"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user