Appearance
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": "/services"
},
{
"text": "接口文档",
"items": [
{
"text": "实时行情 WebSocket 推送",
"link": "/ws-realtime-quote"
},
{
"text": "实时行情 REST 查询",
"link": "/realtime-quotes-api"
},
{
"text": "历史行情查询",
"link": "/hist-quotes-api"
}
]
},
{
"text": "历史数据",
"items": [
{
"text": "网盘数据说明",
"link": "/hist-data-cloud"
},
{
"text": "样例数据下载",
"link": "/hist-data-cloud.html#样例数据下载"
},
{
"text": "Level 1 股票盘口",
"link": "/hist-data-cloud.html#stock-l1"
},
{
"text": "Level 1 ETF盘口",
"link": "/hist-data-cloud.html#etf-l1"
},
{
"text": "Level 1 指数盘口",
"link": "/hist-data-cloud.html#index-l1"
},
{
"text": "Level 1 期货盘口",
"link": "/hist-data-cloud.html#future-l1"
},
{
"text": "Level 1 可转债盘口",
"link": "/hist-data-cloud.html#bond-l1"
},
{
"text": "Level 2 数据",
"link": "/hist-data-cloud.html#level2-数据-三表版"
}
]
},
{
"text": "复盘工作台",
"items": [
{
"text": "行情复盘 · 监控工作台",
"link": "/workbench"
},
{
"text": "进入工作台",
"link": "https://app.zhundata.cn/"
}
]
},
{
"text": "QQ: 657688959",
"link": ""
},
{
"text": "AI Skill",
"link": "/ai-skill"
}
],
"sidebar": [
{
"text": "服务总览",
"link": "/services"
},
{
"text": "接口文档",
"items": [
{
"text": "实时行情 WebSocket 推送",
"link": "/ws-realtime-quote"
},
{
"text": "实时行情 REST 查询",
"link": "/realtime-quotes-api"
},
{
"text": "历史行情查询",
"link": "/hist-quotes-api"
}
]
},
{
"text": "历史数据",
"items": [
{
"text": "网盘数据说明",
"link": "/hist-data-cloud"
},
{
"text": "样例数据下载",
"link": "/hist-data-cloud.html#样例数据下载"
},
{
"text": "Level 1 股票盘口",
"link": "/hist-data-cloud.html#stock-l1"
},
{
"text": "Level 1 ETF盘口",
"link": "/hist-data-cloud.html#etf-l1"
},
{
"text": "Level 1 指数盘口",
"link": "/hist-data-cloud.html#index-l1"
},
{
"text": "Level 1 期货盘口",
"link": "/hist-data-cloud.html#future-l1"
},
{
"text": "Level 1 可转债盘口",
"link": "/hist-data-cloud.html#bond-l1"
},
{
"text": "Level 2 数据",
"link": "/hist-data-cloud.html#level2-数据-三表版"
}
]
},
{
"text": "工作台介绍",
"items": [
{
"text": "行情复盘 · 监控工作台",
"link": "/workbench"
}
]
},
{
"text": "AI Skill",
"items": [
{
"text": "AI Skill(AI Agent 用)",
"link": "/ai-skill"
}
]
}
],
"outline": {
"label": "本页目录"
}
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"head": [
[
"meta",
{
"name": "robots",
"content": "noindex,nofollow"
}
]
],
"outline": "deep"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md"
}Page Frontmatter
{
"head": [
[
"meta",
{
"name": "robots",
"content": "noindex,nofollow"
}
]
],
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.