外观
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": "/news/"
}
],
"sidebar": {
"/news/": [
{
"text": "历史报告",
"items": [
{
"text": "ai_daily_report_2026-05-08",
"link": "/news/ai_daily_report_2026-05-08"
},
{
"text": "ai_daily_report_2026-05-06",
"link": "/news/ai_daily_report_2026-05-06"
},
{
"text": "ai_daily_report_2026-05-05",
"link": "/news/ai_daily_report_2026-05-05"
},
{
"text": "ai_daily_report_2026-05-04",
"link": "/news/ai_daily_report_2026-05-04"
},
{
"text": "ai_daily_report_2026-05-02",
"link": "/news/ai_daily_report_2026-05-02"
},
{
"text": "ai_daily_report_2026-05-01",
"link": "/news/ai_daily_report_2026-05-01"
},
{
"text": "ai_daily_report_2026-04-30",
"link": "/news/ai_daily_report_2026-04-30"
},
{
"text": "ai_daily_report_2026-04-29",
"link": "/news/ai_daily_report_2026-04-29"
},
{
"text": "ai_daily_report_2026-04-28",
"link": "/news/ai_daily_report_2026-04-28"
},
{
"text": "ai_daily_report_2026-04-27",
"link": "/news/ai_daily_report_2026-04-27"
},
{
"text": "ai_daily_report_2026-04-26",
"link": "/news/ai_daily_report_2026-04-26"
},
{
"text": "ai_daily_report_2026-04-25",
"link": "/news/ai_daily_report_2026-04-25"
},
{
"text": "ai_daily_report_2026-04-24",
"link": "/news/ai_daily_report_2026-04-24"
},
{
"text": "ai_daily_report_2026-04-23",
"link": "/news/ai_daily_report_2026-04-23"
},
{
"text": "ai_daily_report_2026-04-22",
"link": "/news/ai_daily_report_2026-04-22"
},
{
"text": "ai_daily_report_2026-04-20",
"link": "/news/ai_daily_report_2026-04-20"
},
{
"text": "ai_daily_report_2026-04-19",
"link": "/news/ai_daily_report_2026-04-19"
},
{
"text": "ai_daily_report_2026-04-18",
"link": "/news/ai_daily_report_2026-04-18"
},
{
"text": "ai_daily_report_2026-04-17",
"link": "/news/ai_daily_report_2026-04-17"
},
{
"text": "ai_daily_report_2026-04-12",
"link": "/news/ai_daily_report_2026-04-12"
},
{
"text": "ai_daily_report_2026-04-11",
"link": "/news/ai_daily_report_2026-04-11"
},
{
"text": "ai_daily_report_2026-04-10",
"link": "/news/ai_daily_report_2026-04-10"
},
{
"text": "ai_daily_report_2026-04-09",
"link": "/news/ai_daily_report_2026-04-09"
},
{
"text": "ai_daily_report_2026-04-06",
"link": "/news/ai_daily_report_2026-04-06"
},
{
"text": "ai_daily_report_2026-04-04",
"link": "/news/ai_daily_report_2026-04-04"
},
{
"text": "ai_daily_report_2026-04-03",
"link": "/news/ai_daily_report_2026-04-03"
},
{
"text": "ai_daily_report_2026-04-02",
"link": "/news/ai_daily_report_2026-04-02"
},
{
"text": "ai_daily_report_2026-03-31",
"link": "/news/ai_daily_report_2026-03-31"
},
{
"text": "ai_daily_report_2026-03-30",
"link": "/news/ai_daily_report_2026-03-30"
},
{
"text": "ai_daily_report_2026-03-29",
"link": "/news/ai_daily_report_2026-03-29"
},
{
"text": "ai_daily_report_2026-03-28",
"link": "/news/ai_daily_report_2026-03-28"
},
{
"text": "ai_daily_report_2026-03-27",
"link": "/news/ai_daily_report_2026-03-27"
},
{
"text": "ai_daily_report_2026-03-25",
"link": "/news/ai_daily_report_2026-03-25"
},
{
"text": "ai_daily_report_2026-03-24",
"link": "/news/ai_daily_report_2026-03-24"
},
{
"text": "ai_daily_report_2026-03-23",
"link": "/news/ai_daily_report_2026-03-23"
},
{
"text": "ai_daily_report_2026-03-22",
"link": "/news/ai_daily_report_2026-03-22"
},
{
"text": "ai_daily_report_2026-03-21",
"link": "/news/ai_daily_report_2026-03-21"
},
{
"text": "ai_daily_report_2026-03-20",
"link": "/news/ai_daily_report_2026-03-20"
},
{
"text": "ai_daily_report_2026-03-19",
"link": "/news/ai_daily_report_2026-03-19"
},
{
"text": "ai_daily_report_2026-03-18",
"link": "/news/ai_daily_report_2026-03-18"
},
{
"text": "ai_daily_report_2026-03-17",
"link": "/news/ai_daily_report_2026-03-17"
},
{
"text": "ai_daily_report_2026-03-16",
"link": "/news/ai_daily_report_2026-03-16"
},
{
"text": "ai_daily_report_2026-03-14",
"link": "/news/ai_daily_report_2026-03-14"
},
{
"text": "ai_daily_report_2026-03-13",
"link": "/news/ai_daily_report_2026-03-13"
},
{
"text": "ai_daily_report_2026-03-12",
"link": "/news/ai_daily_report_2026-03-12"
},
{
"text": "ai_daily_report_2026-03-11",
"link": "/news/ai_daily_report_2026-03-11"
},
{
"text": "ai_daily_report_2026-03-10",
"link": "/news/ai_daily_report_2026-03-10"
}
]
}
]
},
"darkModeSwitchLabel": "外观",
"footer": {
"message": "Powered by OpenClaw & VitePress",
"copyright": "Copyright © 2026-present"
}
}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.