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
{ "logo": "/logo.png", "search": { "provider": "local" }, "nav": [ { "text": "Home", "link": "https://aix.levelinfinite.com" }, { "text": "Dashboard", "link": "https://aix.levelinfinite.com/v2/" } ], "lastUpdated": { "text": "Last Updated" }, "footer": { "copyright": "Tencent Group", "message": "AiX front develop team" }, "sidebar": [ { "items": [ { "text": "About AiX", "link": "/user_guide/desc" }, { "text": "Quick Start Gudiance", "link": "/user_guide/quickstart/desc", "items": [ { "text": "PC & Console Games", "link": "/user_guide/quickstart/pc_quickstart" }, { "text": "Mobile Games", "link": "/user_guide/quickstart/mobile_quickstart" } ] }, { "text": "Business Insight", "link": "/user_guide/bi/desc", "items": [ { "text": "Overview", "link": "/user_guide/bi/overview" }, { "text": "User Acquisition", "link": "/user_guide/bi/user_acquistion" }, { "text": "Pivot", "link": "/user_guide/bi/pivot" } ] }, { "text": "Trading Desk", "link": "/user_guide/td/desc", "items": [ { "text": "Ads Management", "collapsed": true, "link": "/user_guide/td/ad_management", "items": [ { "text": "Report Dashboard", "link": "/user_guide/td/report_dashboard" }, { "text": "Campaign Management", "link": "/user_guide/td/campaign_management" } ] }, { "text": "Monitor", "link": "/user_guide/td/monitor" }, { "text": "Ads Optimization", "link": "/user_guide/td/auto_planing" } ] }, { "text": "Creative Center", "link": "/user_guide/creative/desc", "items": [ { "text": "Creative Management", "link": "/user_guide/creative/creative_management" }, { "text": "Creative Analytics", "link": "/user_guide/creative/creative_dashboard" }, { "text": "Creative AI Tool Kit", "link": "/user_guide/creative/creative_tools" } ] }, { "text": "Audience", "link": "/user_guide/audience/desc", "items": [ { "text": "Manage Audience", "link": "/user_guide/audience/how_it_works" } ] }, { "text": "Intelligence", "link": "/user_guide/Intellience/desc", "items": [ { "text": "Market", "link": "/user_guide/Intellience/market" }, { "text": "Creative(Competitor)", "link": "/user_guide/Intellience/creative" }, { "text": "User", "link": "/user_guide/Intellience/user" } ] }, { "text": "References", "items": [ { "text": "Dashboard Glossary", "link": "/user_guide/references/report_glossary" }, { "text": "Attribution", "link": "/user_guide/references/attribution" }, { "text": "Channel Integration", "link": "/user_guide/references/channel_integration", "collapsed": true, "items": [ { "text": "Facebook/AiX Setup", "link": "/user_guide/references/facebook_setup" }, { "text": "Google/AiX Setup", "link": "/user_guide/references/google_setup" }, { "text": "Reddit/AiX Setup", "link": "/user_guide/references/reddit_setup" }, { "text": "Tiktok/AiX Setup", "link": "/user_guide/references/tiktok_setup" }, { "text": "Twitter/AiX Setup", "link": "/user_guide/references/x_setup" }, { "text": "Vibe/AiX Setup", "link": "/user_guide/references/vibe_setup" }, { "text": "Unity/AiX Setup", "link": "/user_guide/references/unity_setup" }, { "text": "Moloco/AiX Setup", "link": "/user_guide/references/moloco_setup" }, { "text": "IronSource/AiX Setup", "link": "/user_guide/references/ironsource_setup" }, { "text": "DV360/AiX Setup", "link": "/user_guide/references/dv360_setup" }, { "text": "Kwai/AiX Setup", "link": "/user_guide/references/kwai_setup" }, { "text": "AppLovin/AiX Setup", "link": "/user_guide/references/applovin_setup" }, { "text": "Bing/AiX Setup", "link": "/user_guide/references/bing_setup" }, { "text": "Apple Search Ads/AiX Setup", "link": "/user_guide/references/apple_setup" }, { "text": "Snapchat/AiX Setup", "link": "/user_guide/references/snapchat_setup" } ] } ] }, { "text": "legal", "items": [ { "text": "Data Processing Agreement", "link": "/user_guide/legal/dpa" } ] } ] } ] }
Page Data
{ "title": "Runtime API Examples", "description": "", "frontmatter": { "outline": "deep" }, "headers": [], "relativePath": "api-examples.md", "filePath": "api-examples.md", "lastUpdated": 1695804731000 }
Page Frontmatter
{ "outline": "deep" }
More
Check out the documentation for the full list of runtime APIs.