feat: enlarge hero image and add medium-zoom for image lightbox

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
程序员阿江(Relakkes) 2026-04-04 23:50:13 +08:00
parent dcbb6cb03b
commit 1d7cbb845a
4 changed files with 42 additions and 0 deletions

View File

@ -12,3 +12,23 @@
--vp-c-brand-3: #ea9a7a;
--vp-c-brand-soft: rgba(217, 119, 87, 0.16);
}
/* Hero image larger */
.VPHero .image-container {
max-width: 500px !important;
max-height: 500px !important;
}
.VPHero .image-container .image-src {
max-width: 500px !important;
max-height: 500px !important;
}
/* medium-zoom overlay */
.medium-zoom-overlay {
z-index: 30;
}
.medium-zoom-image--opened {
z-index: 31;
}

View File

@ -1,6 +1,20 @@
import DefaultTheme from 'vitepress/theme'
import mediumZoom from 'medium-zoom'
import { onMounted, watch, nextTick } from 'vue'
import { useRoute } from 'vitepress'
import './custom.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
package-lock.json generated
View File

@ -47,6 +47,7 @@
"lodash-es": "^4.17.23",
"lru-cache": "^11.2.7",
"marked": "^17.0.5",
"medium-zoom": "^1.1.0",
"p-map": "^7.0.4",
"picomatch": "^4.0.4",
"proper-lockfile": "^4.1.2",
@ -5416,6 +5417,12 @@
"node": ">= 0.8"
}
},
"node_modules/medium-zoom": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/medium-zoom/-/medium-zoom-1.1.0.tgz",
"integrity": "sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ==",
"license": "MIT"
},
"node_modules/merge-descriptors": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-2.0.0.tgz",

View File

@ -53,6 +53,7 @@
"lodash-es": "^4.17.23",
"lru-cache": "^11.2.7",
"marked": "^17.0.5",
"medium-zoom": "^1.1.0",
"p-map": "^7.0.4",
"picomatch": "^4.0.4",
"proper-lockfile": "^4.1.2",