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": "Home",
"link": "/"
},
{
"text": "深度学习",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第02讲"
},
{
"text": "会议纪要",
"link": "/meeting/组会纪要 - 2025.10.26"
}
],
"sidebar": {
"/dl": [
{
"text": "PyTorch深度学习实践第02讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第02讲.md"
},
{
"text": "PyTorch深度学习实践第03讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第03讲.md"
},
{
"text": "PyTorch深度学习实践第04讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第04讲.md"
},
{
"text": "PyTorch深度学习实践第05讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第05讲.md"
},
{
"text": "PyTorch深度学习实践第06讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第06讲.md"
},
{
"text": "PyTorch深度学习实践第07讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第07讲.md"
},
{
"text": "PyTorch深度学习实践第08讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第08讲.md"
},
{
"text": "PyTorch深度学习实践第09讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第09讲.md"
},
{
"text": "PyTorch深度学习实践第10讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第10讲.md"
},
{
"text": "PyTorch深度学习实践第11讲",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第11讲.md"
},
{
"text": "PyTorch深度学习实践第12讲RNN(基础篇)",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第12讲RNN(基础篇).md"
},
{
"text": "PyTorch深度学习实践第13讲RNN(高级篇)",
"link": "/dl/pytorch_liuii/PyTorch深度学习实践第13讲RNN(高级篇).md"
},
{
"text": "刘二老师的代码合集",
"link": "/dl/pytorch_liuii/刘二老师的代码合集.md"
}
]
},
"outlineTitle": "文章目录",
"outline": [
2,
6
],
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/Tolsen-ux"
}
],
"search": {
"provider": "local",
"options": {
"translations": {
"button": {
"buttonText": "搜索文档",
"buttonAriaLabel": "搜索文档"
},
"modal": {
"noResultsText": "无法找到相关结果",
"resetButtonTitle": "清除查询条件",
"footer": {
"selectText": "选择",
"navigateText": "切换"
}
}
}
}
},
"footer": {
"message": "Copyright © 2024 fly2sky.fun | <a href=\"https://beian.miit.gov.cn/\" target=\"_blank\">冀ICP备2025128436号-1</a>"
}
}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.