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
{ "nav": [ { "text": "主页", "link": "/" }, { "text": "简介", "link": "/iseluo/敬请期待.md" }, { "text": "前端", "link": "/iseluo/敬请期待.md" }, { "text": "后端", "link": "/iseluo/敬请期待.md" }, { "text": "数据恢复", "link": "/iseluo/敬请期待.md" } ], "sidebar": [ { "text": "简介", "items": [ { "text": "网站简介", "link": "/iseluo/敬请期待.md" }, { "text": "一些想说的话", "link": "/iseluo/敬请期待.md" } ] }, { "text": "前端开发", "items": [ { "text": "HTML", "link": "/iseluo/敬请期待.md" }, { "text": "CSS", "link": "/iseluo/敬请期待.md" }, { "text": "JS", "link": "/iseluo/敬请期待.md" } ] }, { "text": "Minecraft插件/模组开发", "items": [ { "text": "Bukkit插件开发", "link": "/iseluo/敬请期待.md" }, { "text": "Fabric模组开发", "link": "/iseluo/敬请期待.md" }, { "text": "Neoforge模组开发", "link": "/iseluo/敬请期待.md" }, { "text": "Java基础", "link": "/iseluo/敬请期待.md" } ] }, { "text": "数据恢复", "items": [ { "text": "分区表修复", "items": [ { "text": "MBR分区表修复", "link": "/iseluo/敬请期待.md" }, { "text": "GPT分区表修复", "link": "/iseluo/敬请期待.md" } ] }, { "text": "文件提取", "items": [ { "text": "FAT32文件系统与文件提取", "items": [ { "text": "FAT32文件系统介绍", "link": "/" }, { "text": "FAT32文件提取", "link": "/" } ] }, { "text": "NTFS文件系统与文件提取", "items": [ { "text": "NTFS文件系统介绍", "link": "/" }, { "text": "NTFS文件提取", "link": "/" } ] }, { "text": "EXFAT文件系统与文件提取", "items": [ { "text": "EXFAT文件系统介绍", "link": "/" }, { "text": "EXFAT文件提取", "link": "/" } ] }, { "text": "HFS+文件系统与文件提取", "items": [ { "text": "HFS+文件系统介绍", "link": "/" }, { "text": "HFS+文件提取", "link": "/" } ] }, { "text": "EXT4/EXT3文件系统与文件提取", "items": [ { "text": "EXT4/EXT3文件系统介绍", "link": "/" }, { "text": "EXT4/EXT3文件提取", "link": "/" } ] } ] }, { "text": "文件修复", "items": [ {} ] }, { "text": "数据加密", "link": "/" } ], "link": "/iseluo/敬请期待" } ], "socialLinks": [ { "icon": "github", "link": "https://github.com/scemoas" } ], "footer": { "copyright": "© 2025 iseluo. 保留所有权利." } }
Page Data
{ "title": "Runtime API Examples", "description": "", "frontmatter": { "outline": "deep" }, "headers": [], "relativePath": "api-examples.md", "filePath": "api-examples.md" }
Page Frontmatter
{ "outline": "deep" }
More
Check out the documentation for the full list of runtime APIs.