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
{
"head": [
[
"link",
{
"rel": "icon",
"href": "/favicon.ico"
}
],
[
"link",
{
"rel": "icon",
"type": "image/png",
"sizes": "32x32",
"href": "/icons/favicon-32x32.png"
}
],
[
"link",
{
"rel": "icon",
"type": "image/png",
"sizes": "16x16",
"href": "/icons/favicon-16x16.png"
}
],
[
"link",
{
"rel": "icon",
"type": "image/png",
"sizes": "96x96",
"href": "/icons/favicon-96x96.png"
}
],
[
"link",
{
"rel": "icon",
"type": "image/png",
"sizes": "128x128",
"href": "/icons/favicon-128x128.png"
}
]
],
"nav": [
{
"text": "Home",
"link": "/"
}
],
"sidebar": [
{
"text": "Usage Document",
"items": [
{
"text": "Inventory",
"items": [
{
"text": "Container & Location Management",
"link": "docs/usage/Inventory/Container & Location Management"
},
{
"text": "Counting",
"link": "docs/usage/Inventory/Counting"
},
{
"text": "Inventory Item",
"link": "docs/usage/Inventory/Inventory Item"
},
{
"text": "Inventory Overview",
"link": "docs/usage/Inventory/Inventory Overview"
},
{
"text": "Lot Management",
"link": "docs/usage/Inventory/Lot Management"
},
{
"text": "Movement History",
"link": "docs/usage/Inventory/Movement History"
},
{
"text": "SKU Details",
"link": "docs/usage/Inventory/SKU Details"
},
{
"text": "SKU List",
"link": "docs/usage/Inventory/SKU List"
}
]
},
{
"text": "Job Center",
"items": [
{
"text": "Clean",
"link": "docs/usage/Job Center/Clean"
},
{
"text": "Job Center Overview",
"link": "docs/usage/Job Center/Job Center Overview"
},
{
"text": "QC",
"link": "docs/usage/Job Center/QC"
},
{
"text": "Repair",
"link": "docs/usage/Job Center/Repair"
}
]
},
{
"text": "Others",
"items": [
{
"text": "Movement",
"link": "docs/usage/Others/Movement"
},
{
"text": "Print Barcode",
"link": "docs/usage/Others/Print Barcode"
}
]
},
{
"text": "Receiving",
"items": [
{
"text": "Control Number Creation & Details",
"link": "docs/usage/Receiving/Control Number Creation & Details"
},
{
"text": "Receiving Introduction",
"link": "docs/usage/Receiving/Receiving Introduction"
},
{
"text": "Scanning Items",
"link": "docs/usage/Receiving/Scanning Items"
},
{
"text": "Tracking",
"link": "docs/usage/Receiving/Tracking"
}
]
},
{
"text": "Relabel",
"items": [
{
"text": "Relabel",
"link": "docs/usage/Relabel/Relabel"
}
]
},
{
"text": "Settings",
"items": [
{
"text": "Account",
"link": "docs/usage/Settings/Account"
},
{
"text": "Roles",
"link": "docs/usage/Settings/Roles"
}
]
},
{
"text": "Shipping",
"items": [
{
"text": "Batch, Pick, Pack Overview",
"link": "docs/usage/Shipping/Batch, Pick, Pack Overview"
},
{
"text": "Batch",
"link": "docs/usage/Shipping/Batch"
},
{
"text": "Order",
"link": "docs/usage/Shipping/Order"
},
{
"text": "Packing",
"link": "docs/usage/Shipping/Packing"
},
{
"text": "Picking",
"link": "docs/usage/Shipping/Picking"
},
{
"text": "Shipment",
"link": "docs/usage/Shipping/Shipment"
}
]
}
]
},
{
"text": "API specification",
"link": "/docs/api-specification/index"
},
{
"text": "Markdown Examples",
"link": "/markdown-examples"
},
{
"text": "Runtime API Examples",
"link": "/api-examples"
}
],
"search": {
"provider": "algolia",
"options": {
"appId": "VFJR3LUR4J",
"apiKey": "82ea835e941e44ff5458c3767fd67ebe",
"indexName": "wai-doc"
}
}
}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.