Runtime API Examples
This page demonstrates usage of some of the runtime APIs provided by VitePress.
The main useData()
API can be used to access site, theme, and page data for the current page. It works in both .md
and .vue
files:
md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
Results
Theme Data
{ "siteTitle": "Audi Tutorials", "lang": "zh-CN", "docFooter": { "prev": "上一篇", "next": "下一篇" }, "darkModeSwitchLabel": "外观", "returnToTopLabel": "返回顶部", "sidebarMenuLabel": "菜单", "outline": { "label": "页面导航" }, "nav": [ { "text": "首页", "link": "/" }, { "text": "ODIS 安装", "link": "/install/odis" }, { "text": "ODIS 编程", "link": "/docs/introduce" }, { "text": "免责声明", "link": "/disclaimer" }, { "text": "Joiner 小组件", "link": "https://joiner.i95.me" }, { "text": "奥迪固件升级", "link": "https://joiner.i95.me/upgrade.html" }, { "text": "MIB 固件验证", "link": "https://mib.i95.me" } ], "sidebar": { "/install/": [ { "text": "ODIS 安装", "items": [ { "text": "安装", "link": "/install/odis" }, { "text": "下载", "link": "/install/resource" } ] } ], "/docs/": [ { "text": "ODIS 编程", "items": [ { "text": "编程准备提示", "link": "/docs/introduce" }, { "text": "Android 盒子屏蔽", "link": "/docs/android-box-blocking" }, { "text": "锁车声音", "link": "/docs/lock-sound" }, { "text": "激活车道保持", "link": "/docs/lane-keeping-assist" }, { "text": "运动布局", "link": "/docs/sport-layout" }, { "text": "无线 CarPlay", "link": "/docs/wireless-carplay" }, { "text": "无线 Android Auto", "link": "/docs/wireless-android-auto" }, { "text": "关闭启停", "link": "/docs/disable-start-stop" }, { "text": "运动指针", "link": "/docs/sport-pointer" }, { "text": "开机画面", "link": "/docs/startup-screen" }, { "text": "转向灯轻拨闪烁次数", "link": "/docs/turn-signal-flash-count" }, { "text": "开门亮同方向尾灯", "link": "/docs/door-open-taillight" }, { "text": "氛围灯激活", "link": "/docs/ambient-light-activation" }, { "text": "倒车影像激活", "link": "/docs/reverse-camera-activation" }, { "text": "显示日间行车灯", "link": "/docs/daytime-running-lights" }, { "text": "显示自动落锁", "link": "/docs/auto-lock-display" }, { "text": "关闭安全带提示音", "link": "/docs/disable-seatbelt-warning" }, { "text": "单门解锁", "link": "/docs/single-door-unlock" }, { "text": "单圈计时器", "link": "/docs/lap-timer" }, { "text": "倒车灯亮度调整", "link": "/docs/reverse-light-brightness" }, { "text": "倒车有后视镜自动下翻", "link": "/docs/mirror-auto-tilt-reverse" }, { "text": "低速行驶前雷达预警", "link": "/docs/low-speed-front-radar" }, { "text": "回家大灯模式", "link": "/docs/coming-home-lights" }, { "text": "雾灯转向功能", "link": "/docs/fog-light-cornering" }, { "text": "设置开锁方式", "link": "/docs/unlock-method-setting" }, { "text": "设置天窗全开", "link": "/docs/sunroof-full-open" }, { "text": "锁车双闪", "link": "/docs/lock-hazard-flash" }, { "text": "尾灯转向灯交替闪烁", "link": "/docs/taillight-turn-signal-alternate" }, { "text": "未熄火可锁车", "link": "/docs/lock-while-running" }, { "text": "熄火后可调整车窗", "link": "/docs/window-adjust-after-shutdown" }, { "text": "行车播放视频", "link": "/docs/video-while-driving" }, { "text": "仪表启动画面", "link": "/docs/instrument-startup-screen" }, { "text": "刹车尾灯全亮", "link": "/docs/brake-taillight-full-bright" }, { "text": "开后备箱刹车灯亮", "link": "/docs/trunk-open-brake-light" }, { "text": "刹车灯爆闪", "link": "/docs/brake-light-flash" }, { "text": "燃油加注量", "link": "/docs/fuel-tank-capacity" }, { "text": "倒车雾灯辅助", "link": "/docs/reverse-fog-light-assist" }, { "text": "熄火后按喇叭不响", "link": "/docs/horn-disable-after-shutdown" }, { "text": "日行灯交替闪", "link": "/docs/drl-alternate-flash" }, { "text": "直接式胎压监测", "link": "/docs/direct-tpms" }, { "text": "大众汽车集团隐藏菜单", "link": "/docs/audi-hidden-menu" }, { "text": "调节倒车灯亮度", "link": "/docs/adjust-reverse-light-brightness" } ] } ] }, "socialLinks": [ { "icon": "bloglovin", "link": "https://iiong.com" } ], "footer": { "copyright": "Copyright © 2025. <a href=\"https://iiong.com\" target=\"_blank\" rel=\"nofollow noopener\">淮城一只猫</a> - <a href=\"http://beian.miit.gov.cn\" target=\"_blank\" rel=\"nofollow noopener\">苏ICP备15050739号</a>" } }
Page Data
{ "title": "Runtime API Examples", "description": "", "frontmatter": { "outline": "deep" }, "headers": [], "relativePath": "api-examples.md", "filePath": "api-examples.md", "lastUpdated": null }
Page Frontmatter
{ "outline": "deep" }
More
Check out the documentation for the full list of runtime APIs.