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 123123123
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>Results
Theme Data
{
"nav": [
{
"text": "Примеры",
"link": "/примеры/пример-запуск-модели"
},
{
"text": "Index",
"link": "/"
},
{
"text": "Api Examples",
"link": "/api-examples"
},
{
"text": "Markdown Examples",
"link": "/markdown-examples"
},
{
"text": "123",
"link": "/123"
},
{
"text": "Test",
"link": "/test"
}
],
"sidebar": [
{
"text": "Примеры",
"collapsed": false,
"items": [
{
"text": "Пример запуск модели на python",
"link": "/примеры/пример-запуск-модели"
},
{
"text": "strf2ffв2dffdd22f22in11111g",
"link": "/примеры/string"
}
]
},
{
"text": "Index",
"link": "/"
},
{
"text": "Api Examples",
"link": "/api-examples"
},
{
"text": "Markdown Examples",
"link": "/markdown-examples"
},
{
"text": "123",
"link": "/123"
},
{
"text": "Test",
"link": "/test"
}
],
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/vuejs/vitepress"
}
],
"search": {
"provider": "local"
}
}Page Data
{
"title": "Api Examples",
"description": "",
"frontmatter": {
"title": "Api Examples"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md"
}Page Frontmatter
{
"title": "Api Examples"
}More
Check out the documentation for the full list of runtime APIs.