图片预览
约 225 字小于 1 分钟
2025-07-03
在主题中,图片默认支持点击后放大预览。通过查找 文档内容中的图片,形成图片预览列表。
该功能由 @vuepress/plugin-photo-swipe 插件提供支持。
配置
图片预览默认启用,也可以通过以下配置修改行为:
.vuepress/config.ts
export default defineUserConfig({
theme: plumeTheme({
plugins: {
photoSwipe: {
// 图片选择器
selector: '[vp-content] :not(a) > img:not([no-view],.no-view,.ignore)',
download: true, // 是否显示下载按钮
fullscreen: true, // 是否显示全屏按钮
scrollToClose: true, // 是否在滚动时关闭当前图片
}
}
})
})
更多配置请参考 @vuepress/plugin-photo-swipe
忽略图片预览
可以通过 no-view
或 ignore
类名,或者 no-view
属性来忽略图片预览。
{.no-view}
{.ignore}
{no-view}
<img src="path/to/image" class="no-view">
<img src="path/to/image" class="ignore">
<img src="path/to/image" no-view>