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
{ "logo": "/logo.png", "search": { "provider": "local", "options": { "locales": { "root": { "translations": { "button": { "buttonText": "搜索文档", "buttonAriaLabel": "搜索文档" }, "modal": { "noResultsText": "无法找到相关结果", "resetButtonTitle": "清除查询条件", "footer": { "selectText": "选择", "navigateText": "切换" } } } } } } }, "sidebar": { "/zh/": [ { "text": "文档首页", "collapsed": false, "link": "/zh/index.md" }, { "text": "快速部署", "collapsed": false, "items": [ { "text": "win快速部署教程", "link": "/zh/Rapid-Deployment/Win-Floolproof.md" }, { "text": "linux快速部署教程", "link": "/zh/Rapid-Deployment/Linux-Floolproof.md" }, { "text": "mac快速部署教程", "link": "/zh/Rapid-Deployment/Mac-Floolproof.md" } ] }, { "text": "使用说明", "collapsed": false, "items": [ { "text": "前言", "link": "/zh/Use-Instructions/Preface.md" }, { "text": "intalink表结构说明", "link": "/zh/Use-Instructions/Table-Structrue.md" }, { "text": "Intalink(开源版数据表结构)", "link": "/zh/Use-Instructions/Open-Table-Explanation.md" }, { "text": "数据关系表达式规则说明", "link": "/zh/Use-Instructions/Data-Association.md" }, { "text": "Intalink接口调用方法", "link": "/zh/Use-Instructions/API-Usage.md" }, { "text": "Intalink链路数据说明", "link": "/zh/Use-Instructions/Data-Explanation.md" }, { "text": "系统部署说明", "link": "/zh/Use-Instructions/System-Deployment.md" } ] }, { "text": "数据治理开发规范", "collapsed": false, "items": [ { "text": "前端开发规范", "link": "/zh/Data-Governance/web.md", "items": [ { "text": "命名规范", "link": "/zh/Data-Governance/NamingConvention.md" }, { "text": "结构化规范", "link": "/zh/Data-Governance/Structured.md" }, { "text": "注释规范", "link": "/zh/Data-Governance/Annotation.md" }, { "text": "编码规范", "link": "/zh/Data-Governance/Encoding.md" }, { "text": "CSS 规范", "link": "/zh/Data-Governance/CSS.md" } ] }, { "text": "后端开发规范", "link": "/zh/Use-Instructions/Table-Structrue.md" } ] }, { "text": "API", "collapsed": false, "items": [ { "text": "API", "link": "/api-examples" } ] } ], "/en/": [ { "text": "Home", "collapsed": false, "link": "/en/index.md" }, { "text": "Rapid deployment", "collapsed": false, "items": [ { "text": "Win Quick Deployment Guide", "link": "/en/Rapid-Deployment/Win-Floolproof.md" }, { "text": "Linux Quick Deployment Guide", "link": "/en/Rapid-Deployment/Linux-Floolproof.md" }, { "text": "Mac Quick Deployment Guide", "link": "/en/Rapid-Deployment/Mac-Floolproof.md" } ] }, { "text": "instructions", "collapsed": false, "items": [ { "text": "Preface", "link": "/en/Use-Instructions/Preface.md" }, { "text": "Intalink Table Structure Explanation", "link": "/en/Use-Instructions/Table-Structrue.md" }, { "text": "Intalink (Open Source Edition Data Table Structure)", "link": "/en/Use-Instructions/Open-Table-Explanation.md" }, { "text": "Data Relationship Expression Rules Explanation", "link": "/en/Use-Instructions/Data-Association.md" }, { "text": "Intalink API Usage Methods", "link": "/en/Use-Instructions/API-Usage.md" }, { "text": "Intalink Link Data Explanation", "link": "/en/Use-Instructions/Data-Explanation.md" }, { "text": "System Deployment Instructions", "link": "/en/Use-Instructions/System-Deployment.md" } ] }, { "text": "API", "collapsed": false, "items": [ { "text": "API", "link": "/api-examples" } ] } ] }, "socialLinks": [ { "icon": "github", "link": "https://github.com/YT-DATA/INTALINK" } ] }
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.