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": "Home",
"link": "/"
},
{
"text": "Examples",
"link": "/markdown-examples"
}
],
"search": {
"provider": "local"
},
"localeLinks": {
"text": "语言",
"items": [
{
"text": "简体中文",
"link": "/"
},
{
"text": "English",
"link": "/en/"
}
]
},
"siteTitle": "嵋塔工业",
"logo": {
"light": "/pdump.svg",
"dark": "/pdump白.svg"
},
"sidebar": [
{
"text": "\n <div class=\"sidebar-item-wrapper\">\n \n <!-- 左侧:图片 + 文字 -->\n <div class=\"sidebar-item-content\">\n <img src=\"/吹风机.jpg\" class=\"sidebar-thumb\">\n <span class=\"sidebar-text\">01pdump</span>\n </div>\n\n <!-- 右侧:按钮 -->\n <a href=\"/examples/01projecte/index.html\"\n target=\"_blank\"\n class=\"full-screen-tag\"\n onclick=\"event.stopPropagation()\">\n 全屏 ↗\n </a>\n\n </div>\n ",
"link": "/01threejs.md"
},
{
"text": "\n <div class=\"sidebar-item-wrapper\">\n <div class=\"sidebar-item-content\">\n <img src=\"/吹风机.jpg\" class=\"sidebar-thumb\">\n <span class=\"sidebar-text\" title=\"02threejs\">02threejs</span>\n </div>\n <a href=\"/examples/01projecte/index.html\" \n target=\"_blank\" \n class=\"full-screen-tag\"\n onclick=\"event.stopPropagation()\">\n 全屏 ↗\n </a>\n </div>\n ",
"link": "/02threejs.md"
},
{
"text": "\n <div class=\"sidebar-item-wrapper\">\n <div class=\"sidebar-item-content\">\n <img src=\"/吹风机.jpg\" class=\"sidebar-thumb\">\n <span class=\"sidebar-text\" title=\"03threejs\">03threejs</span>\n </div>\n <a href=\"/examples/01projecte/index.html\" \n target=\"_blank\" \n class=\"full-screen-tag\"\n onclick=\"event.stopPropagation()\">\n 全屏 ↗\n </a>\n </div>\n ",
"link": "/03threejs.md"
},
{
"text": "\n <div class=\"sidebar-item-wrapper\">\n <div class=\"sidebar-item-content\">\n <img src=\"/吹风机.jpg\" class=\"sidebar-thumb\">\n <span class=\"sidebar-text\" title=\"01pdump00000000000000\">01pdump00000000000000</span>\n </div>\n <a href=\"/examples/01projecte/index.html\" \n target=\"_blank\" \n class=\"full-screen-tag\"\n onclick=\"event.stopPropagation()\">\n 全屏 ↗\n </a>\n </div>\n ",
"link": "/01threejs.md"
},
{
"text": "\n <div class=\"sidebar-item-wrapper\">\n <div class=\"sidebar-item-content\">\n <img src=\"/吹风机.jpg\" class=\"sidebar-thumb\">\n <span class=\"sidebar-text\" title=\"01pdump00000000000000\">01pdump00000000000000</span>\n </div>\n <a href=\"/examples/01projecte/index.html\" \n target=\"_blank\" \n class=\"full-screen-tag\"\n onclick=\"event.stopPropagation()\">\n 全屏 ↗\n </a>\n </div>\n ",
"link": "/01threejs.md"
},
{
"text": "组2| pdump",
"collapsed": true,
"items": [
{
"text": "\n <div class=\"sidebar-item-wrapper\">\n \n <!-- 左侧:图片 + 文字 -->\n <div class=\"sidebar-item-content\">\n <img src=\"/吹风机.jpg\" class=\"sidebar-thumb\">\n <span class=\"sidebar-text\">01pdump</span>\n </div>\n\n <!-- 右侧:按钮 -->\n <a href=\"/examples/01projecte/index.html\"\n target=\"_blank\"\n class=\"full-screen-tag\"\n onclick=\"event.stopPropagation()\">\n 全屏 ↗\n </a>\n\n </div>\n ",
"link": "/01threejs.md"
},
{
"text": "\n <div class=\"sidebar-item-wrapper\">\n \n <!-- 左侧:图片 + 文字 -->\n <div class=\"sidebar-item-content\">\n <img src=\"/吹风机.jpg\" class=\"sidebar-thumb\">\n <span class=\"sidebar-text\">01pdump</span>\n </div>\n\n <!-- 右侧:按钮 -->\n <a href=\"/examples/01projecte/index.html\"\n target=\"_blank\"\n class=\"full-screen-tag\"\n onclick=\"event.stopPropagation()\">\n 全屏 ↗\n </a>\n\n </div>\n ",
"link": "/01threejs.md"
}
]
},
{
"text": "组3| pdump",
"collapsible": true,
"collapsed": true,
"items": [
{
"text": "<img src=\"/吹风机.jpg\" style=\"width:250px; vertical-align: middle; margin-right:8px;\"> ",
"link": "/01threejs.md"
},
{
"text": " 01pdump",
"link": "/examples/01projecte/index.html",
"target": "_blank",
"rel": "noopener noreferrer"
},
{
"text": "<img src=\"/吹风机.jpg\" style=\"width:250px; vertical-align: middle; margin-right:8px;\"> ",
"link": "/01threejs.md"
},
{
"text": " 01pdump",
"link": "/examples/01projecte/index.html",
"target": "_blank",
"rel": "noopener noreferrer"
}
]
},
{
"text": "[01] RhinoCommon API",
"collapsed": true,
"items": [
{
"text": "[1-1] 命名空间",
"collapsed": true,
"items": [
{
"text": "[1-1-1] Rhino",
"collapsed": true,
"items": [
{
"text": "<img src=\"/吹风机.jpg\" style=\"width:250px; vertical-align: middle; margin-right:8px;\"> ",
"link": "/01threejs.md"
},
{
"text": " 01pdump",
"link": "/examples/01projecte/index.html",
"target": "_blank",
"rel": "noopener noreferrer"
},
{
"text": "<img src=\"/吹风机.jpg\" style=\"width:250px; vertical-align: middle; margin-right:8px;\"> ",
"link": "/01threejs.md"
},
{
"text": " 01pdump",
"link": "/examples/01projecte/index.html",
"target": "_blank",
"rel": "noopener noreferrer"
}
]
}
]
}
]
},
{
"text": "[01] RhinoCommon API",
"collapsed": true,
"items": [
{
"text": "[1-1] 命名空间",
"collapsed": true,
"items": [
{
"text": "[1-1-1] Rhino",
"collapsed": true,
"items": [
{
"text": "<img src=\"/吹风机.jpg\" style=\"width:250px; vertical-align: middle; margin-right:8px;\"> ",
"link": "/01threejs.md"
},
{
"text": " 01pdump",
"link": "/examples/01projecte/index.html",
"target": "_blank",
"rel": "noopener noreferrer"
},
{
"text": "<img src=\"/吹风机.jpg\" style=\"width:250px; vertical-align: middle; margin-right:8px;\"> ",
"link": "/01threejs.md"
},
{
"text": " 01pdump",
"link": "/examples/01projecte/index.html",
"target": "_blank",
"rel": "noopener noreferrer"
}
]
}
]
},
{
"text": "[1-1] 命名空间",
"collapsed": true,
"items": [
{
"text": "[1-1-1] Rhino",
"collapsed": true,
"items": [
{
"text": "<img src=\"/吹风机.jpg\" style=\"width:250px; vertical-align: middle; margin-right:8px;\"> ",
"link": "/01threejs.md"
},
{
"text": " 01pdump",
"link": "/examples/01projecte/index.html",
"target": "_blank",
"rel": "noopener noreferrer"
},
{
"text": "<img src=\"/吹风机.jpg\" style=\"width:250px; vertical-align: middle; margin-right:8px;\"> ",
"link": "/01threejs.md"
},
{
"text": " 01pdump",
"link": "/examples/01projecte/index.html",
"target": "_blank",
"rel": "noopener noreferrer"
}
]
}
]
}
]
}
]
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"aside": false,
"outline": false
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md"
}Page Frontmatter
{
"aside": false,
"outline": false
}More
Check out the documentation for the full list of runtime APIs.