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
{
"siteTitle": "batuly",
"search": {
"provider": "local"
},
"nav": [
{
"text": "How To Use ? ",
"link": "introduction/overview"
},
{
"text": "Get Started for Free",
"link": "https://batuly.com/getting-started",
"class": "get-started-btn"
}
],
"socialLinks": [
{
"icon": "facebook",
"link": "https://www.facebook.com/batulyforbusiness/"
},
{
"icon": "instagram",
"link": "https://www.instagram.com/batulyforbusiness/"
},
{
"icon": "tiktok",
"link": "https://www.tiktok.com/@batulyforbusiness"
},
{
"icon": "youtube",
"link": "https://www.youtube.com/@batulyforbusiness"
}
],
"footer": {
"copyright": "Made With ❤️ By Byte Encoder Pvt. Ltd."
},
"sidebar": [
{
"text": "Introduction to batuly",
"collapsed": false,
"items": [
{
"text": "Overview",
"link": "/introduction/overview"
},
{
"text": "System Requirement",
"link": "/introduction/system-requirement"
},
{
"text": "Key Features",
"link": "/introduction/key-features"
},
{
"text": "Getting Started",
"link": "/introduction/getting-started"
}
]
},
{
"text": "Product Management",
"collapsed": false,
"items": [
{
"text": "Unit Group",
"link": "/features/unit-groups-management"
},
{
"text": "Unit",
"link": "/features/units-management"
},
{
"text": "Category",
"link": "/features/product-categories-management"
},
{
"text": "Product",
"link": "/features/products-management"
},
{
"text": "Inventories",
"link": "/features/inventories-management"
}
]
},
{
"text": "Payment Management",
"collapsed": false,
"items": [
{
"text": "Payments",
"link": "/features/payments-management"
},
{
"text": "Payments Method",
"link": "/features/payment-methods-management"
}
]
},
{
"text": "Purchase Management",
"collapsed": false,
"items": [
{
"text": "Supplier Group",
"link": "/features/supplier-groups-management"
},
{
"text": "Supplier ",
"link": "/features/suppliers-management"
},
{
"text": "Purchase",
"link": "/features/purchases-management"
}
]
},
{
"text": "Expenses Management",
"collapsed": false,
"items": [
{
"text": "Expenses",
"link": "/features/expenses-management"
}
]
},
{
"text": "Sales Management",
"collapsed": false,
"items": [
{
"text": "Customer Group",
"link": "/features/customer-groups-management"
},
{
"text": "Customer ",
"link": "/features/customers-management"
},
{
"text": "Sales / POS Screen ",
"link": "/features/pos-screen-management"
},
{
"text": "Sales List / Return",
"link": "/features/sales-management"
}
]
},
{
"text": "All Reports",
"collapsed": false,
"items": [
{
"text": "Sales Reports",
"link": "/reports/sales-reports"
},
{
"text": "Purchase Reports",
"link": "/reports/purchase-reports"
},
{
"text": "Product Reports",
"link": "/reports/product-reports"
},
{
"text": "Stock / Inventory Reports",
"link": "/reports/stock-inventory-reports"
},
{
"text": "Customer Reports",
"link": "/reports/customer-reports"
},
{
"text": "Supplier Reports",
"link": "/reports/supplier-reports"
},
{
"text": "Profit & Loss Reports",
"link": "/reports/profit-loss-reports"
},
{
"text": "Payment Reports",
"link": "/reports/payment-reports"
},
{
"text": "Cheque Reports",
"link": "/reports/cheque-reports"
},
{
"text": "Tax Reports",
"link": "/reports/tax-reports"
},
{
"text": "Annual Reports",
"link": "/reports/annual-reports"
}
]
}
]
}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.