feat: 图片点击放大支持 (medium-zoom)
All checks were successful
Deploy to Cloudflare Pages / deploy (push) Successful in 42s
All checks were successful
Deploy to Cloudflare Pages / deploy (push) Successful in 42s
This commit is contained in:
18
docs/.vitepress/theme/index.ts
Normal file
18
docs/.vitepress/theme/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import DefaultTheme from "vitepress/theme";
|
||||
import mediumZoom from "medium-zoom";
|
||||
import { onMounted, watch, nextTick } from "vue";
|
||||
import { useRoute } from "vitepress";
|
||||
|
||||
import "./zoom.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()));
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user