Enterdawn University

Official website of Enterdawn University

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",
  "footer": {
    "message": "Enterdawn Universuty并不是一所真正的大学,详情请阅读<a style=\"color: deepskyblue;\" href=\"/article/others/about.html\">关于本站</a>",
    "copyright": "Enterdawn University is not a real university. For more details, please read <a style=\"color: deepskyblue;\"  href=\"/article/others/about.html\">about us</a>"
  }
}

Page Data

{
  "title": "示例页面2",
  "description": "",
  "frontmatter": {
    "outline": "deep",
    "title": "示例页面2",
    "date": "2025-12-15T00:00:00.000Z",
    "comment": false
  },
  "headers": [],
  "relativePath": "api-examples.md",
  "filePath": "api-examples.md"
}

Page Frontmatter

{
  "outline": "deep",
  "title": "示例页面2",
  "date": "2025-12-15T00:00:00.000Z",
  "comment": false
}

More

Check out the documentation for the full list of runtime APIs.


评论区已关闭