配置项文件
This page demonstrates usage of some of the runtime APIs provided by VitePress3334444.
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": "/views/about/recommend"
}
],
"sidebar": [
{
"text": "Examples",
"items": [
{
"text": "宝藏工具推荐",
"link": "/views/about/recommend"
},
{
"text": "若依Nodejs全栈",
"collapsed": false,
"items": [
{
"text": "在线预览",
"link": "/views/ruoyi/article6"
},
{
"text": "初始化",
"link": "/views/ruoyi/article1"
},
{
"text": "登录接口",
"link": "/views/ruoyi/article2"
},
{
"text": "用户信息和路由",
"link": "/views/ruoyi/article3"
},
{
"text": "用户增删改查",
"link": "/views/ruoyi/article4"
},
{
"text": "导出Excel",
"link": "/views/ruoyi/article5"
}
]
},
{
"text": "Electron仿微信",
"collapsed": false,
"items": [
{
"text": "高度还原微信",
"link": "/views/electron/article1"
},
{
"text": "联动关闭子窗口",
"link": "/views/electron/article2"
},
{
"text": "新建贴合窗口",
"link": "/views/electron/article3"
},
{
"text": "新开窗口",
"link": "/views/electron/article5"
},
{
"text": "置顶、最大化、最小化",
"link": "/views/electron/article6"
}
]
},
{
"text": "关于作者",
"link": "/views/about/author"
},
{
"text": "配置项",
"link": "/api-examples"
}
]
}
],
"socialLinks": [
{
"icon": "github",
"link": "https://gitee.com/ruirui-study",
"ariaLabel": "码云"
}
],
"externalLinkIcon": true,
"footer": {
"message": "Released under the MIT License.",
"copyright": "Copyright © 2019-2024 Yan Rui"
},
"lastUpdated": {
"text": "最后更新时间"
},
"docFooter": {
"prev": "上一篇",
"next": "下一篇"
},
"outline": {
"label": "导航目录"
}
}Page Data
{
"title": "配置项文件",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md",
"lastUpdated": 1729303988000
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.