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()));
|
||||||
|
},
|
||||||
|
};
|
||||||
7
docs/.vitepress/theme/zoom.css
Normal file
7
docs/.vitepress/theme/zoom.css
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.medium-zoom-overlay {
|
||||||
|
z-index: 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
.medium-zoom-image--opened {
|
||||||
|
z-index: 31;
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "xcodecli-docs",
|
"name": "xcodecli-docs",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"medium-zoom": "^1.1.0",
|
||||||
"vitepress": "^1.5.0",
|
"vitepress": "^1.5.0",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -272,6 +273,8 @@
|
|||||||
|
|
||||||
"mdast-util-to-hast": ["mdast-util-to-hast@13.2.1", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA=="],
|
"mdast-util-to-hast": ["mdast-util-to-hast@13.2.1", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA=="],
|
||||||
|
|
||||||
|
"medium-zoom": ["medium-zoom@1.1.0", "", {}, "sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ=="],
|
||||||
|
|
||||||
"micromark-util-character": ["micromark-util-character@2.1.1", "", { "dependencies": { "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q=="],
|
"micromark-util-character": ["micromark-util-character@2.1.1", "", { "dependencies": { "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q=="],
|
||||||
|
|
||||||
"micromark-util-encode": ["micromark-util-encode@2.0.1", "", {}, "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw=="],
|
"micromark-util-encode": ["micromark-util-encode@2.0.1", "", {}, "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw=="],
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"preview": "vitepress preview"
|
"preview": "vitepress preview"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"medium-zoom": "^1.1.0",
|
||||||
"vitepress": "^1.5.0"
|
"vitepress": "^1.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user