Skip to content

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": "/vite.svg",
  "siteTitle": "iNET Portal Docs",
  "nav": [
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "eKYC",
      "link": "/ekyc/"
    },
    {
      "text": "API Examples",
      "link": "/api-examples"
    }
  ],
  "sidebar": {
    "/ekyc/": [
      {
        "text": "🎓 eKYC & Face Liveness",
        "items": [
          {
            "text": "00. Case Study",
            "link": "/ekyc/00-case-study"
          },
          {
            "text": "📖 Tổng quan",
            "link": "/ekyc/"
          }
        ]
      },
      {
        "text": "📚 Phần 1: Foundations",
        "items": [
          {
            "text": "01. Tổng quan hệ thống",
            "link": "/ekyc/01-overview"
          },
          {
            "text": "02. Chi tiết flow steps",
            "link": "/ekyc/02-flow-steps"
          }
        ]
      },
      {
        "text": "🔧 Phần 2: MediaPipe & Camera",
        "items": [
          {
            "text": "03. Giới thiệu MediaPipe",
            "link": "/ekyc/03-mediapipe-intro"
          },
          {
            "text": "04. Wrapper class",
            "link": "/ekyc/04-wrapper-class"
          },
          {
            "text": "05. Camera pipeline",
            "link": "/ekyc/05-camera-pipeline"
          },
          {
            "text": "06a. Face Detection Fundamentals",
            "link": "/ekyc/06a-face-detection-fundamentals"
          },
          {
            "text": "06b. Liveness Calculation",
            "link": "/ekyc/06-liveness-calculation"
          },
          {
            "text": "07. Backend integration",
            "link": "/ekyc/07-backend-integration"
          },
          {
            "text": "08a. Xử lý Ward/District/Province",
            "link": "/ekyc/08a-ward-processing"
          },
          {
            "text": "08b. Review & Check2FA",
            "link": "/ekyc/08-review-check2fa"
          },
          {
            "text": "09. I18n & UX",
            "link": "/ekyc/09-i18n-ux"
          }
        ]
      },
      {
        "text": "⚛️ Phần 3: Vue Specific",
        "items": [
          {
            "text": "10. Vue Pros & Cons",
            "link": "/ekyc/10-vue-pros-cons"
          }
        ]
      },
      {
        "text": "⚠️ Phần 4: Production Issues",
        "items": [
          {
            "text": "11. Production issue",
            "link": "/ekyc/11-production-issue"
          },
          {
            "text": "12. Vite plugin fix",
            "link": "/ekyc/12-vite-plugin-fix"
          }
        ]
      }
    ]
  },
  "socialLinks": [
    {
      "icon": "github",
      "link": "https://github.com/inet-vn"
    }
  ],
  "footer": {
    "message": "Internal documentation for iNET Portal",
    "copyright": "Copyright © 2025 iNET"
  },
  "search": {
    "provider": "local"
  },
  "editLink": {
    "pattern": "https://github.com/inet-vn/portal/edit/main/documentation/src/:path",
    "text": "Edit this page on GitHub"
  },
  "outline": {
    "level": [
      2,
      3
    ],
    "label": "On this page"
  }
}

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.

Internal documentation for iNET Portal