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": {
    "src": "/images/vb6.pro-logo-32x32.png",
    "width": 24,
    "height": 24
  },
  "socialLinks": [
    {
      "icon": "googlehome",
      "link": "http://a-vi.com"
    },
    {
      "icon": "rocketdotchat",
      "link": "https://chat.vb6.pro/"
    }
  ],
  "search": {
    "provider": "local",
    "options": {
      "translations": {
        "button": {
          "buttonText": "全局搜索...",
          "buttonAriaLabel": "搜索"
        },
        "modal": {
          "noResultsText": "无法找到相关结果",
          "resetButtonTitle": "清除查询条件",
          "footer": {
            "selectText": "选择",
            "navigateText": "切换",
            "closeText": "关闭"
          }
        }
      }
    }
  },
  "nav": [
    {
      "text": "首页",
      "link": "/"
    },
    {
      "text": "VBMAN",
      "link": "/vbman/"
    },
    {
      "text": "VBMAN2",
      "link": "/vbman2/"
    },
    {
      "text": "VBCCR",
      "link": "/vbccr/"
    },
    {
      "text": "捐赠",
      "link": "/donate/"
    },
    {
      "text": "加群",
      "link": "http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=maQtC3a5Zxb3gMLvwpj6oE5fwmZGCOlY&authKey=8%2FhBgSMLqADLatzXghFXO5BIBa%2BxSoHO%2FHFvtbZQk2kURUx%2FegxZukzAvhSPX6WJ&noverify=0&group_code=915520648"
    },
    {
      "text": "更多",
      "items": [
        {
          "text": "旧版文档",
          "link": "https://doc0.vb6.pro/"
        },
        {
          "text": "博客",
          "link": "https://vb6.pro/"
        }
      ]
    }
  ],
  "outline": {
    "level": "deep",
    "label": "页内目录"
  },
  "sidebar": {
    "/vbccr/": [
      {
        "text": "VBCCR 控件",
        "items": [
          {
            "text": "介绍",
            "link": "/vbccr/"
          },
          {
            "text": "动画控件",
            "link": "/vbccr/animation"
          },
          {
            "text": "复选框控件",
            "link": "/vbccr/checkbox"
          },
          {
            "text": "组合框控件",
            "link": "/vbccr/combobox"
          },
          {
            "text": "命令按钮控件",
            "link": "/vbccr/commandbutton"
          },
          {
            "text": "命令链接控件",
            "link": "/vbccr/commandlink"
          },
          {
            "text": "通用对话框控件",
            "link": "/vbccr/commondialog"
          },
          {
            "text": "工具条控件",
            "link": "/vbccr/coolbar"
          },
          {
            "text": "日期时间选择器控件",
            "link": "/vbccr/datetimepicker"
          },
          {
            "text": "驱动器列表控件",
            "link": "/vbccr/drivelist"
          },
          {
            "text": "驱动器路径控件",
            "link": "/vbccr/drivepath"
          },
          {
            "text": "文件路径控件",
            "link": "/vbccr/filepath"
          },
          {
            "text": "字体组合框控件",
            "link": "/vbccr/fontcombo"
          },
          {
            "text": "框架控件",
            "link": "/vbccr/frame"
          },
          {
            "text": "热键控件",
            "link": "/vbccr/hotkey"
          },
          {
            "text": "图像组合框控件",
            "link": "/vbccr/imagecombo"
          },
          {
            "text": "图像列表控件",
            "link": "/vbccr/imagelist"
          },
          {
            "text": "IP地址控件",
            "link": "/vbccr/ipaddress"
          },
          {
            "text": "标签控件",
            "link": "/vbccr/label"
          },
          {
            "text": "线条控件",
            "link": "/vbccr/line"
          },
          {
            "text": "链接标签控件",
            "link": "/vbccr/linklabel"
          },
          {
            "text": "列表框控件",
            "link": "/vbccr/listbox"
          },
          {
            "text": "列表视图控件",
            "link": "/vbccr/listview"
          },
          {
            "text": "多媒体控件",
            "link": "/vbccr/mciwnd"
          },
          {
            "text": "月历控件",
            "link": "/vbccr/monthcalendar"
          },
          {
            "text": "月视图控件",
            "link": "/vbccr/monthview"
          },
          {
            "text": "选项控件",
            "link": "/vbccr/option"
          },
          {
            "text": "选项按钮控件",
            "link": "/vbccr/optionbutton"
          },
          {
            "text": "分页控件",
            "link": "/vbccr/pager"
          },
          {
            "text": "图片框控件",
            "link": "/vbccr/picture"
          },
          {
            "text": "进度条控件",
            "link": "/vbccr/progressbar"
          },
          {
            "text": "富文本框控件",
            "link": "/vbccr/richtextbox"
          },
          {
            "text": "滚动条控件",
            "link": "/vbccr/scrollbar"
          },
          {
            "text": "形状控件",
            "link": "/vbccr/shape"
          },
          {
            "text": "滑块控件",
            "link": "/vbccr/slider"
          },
          {
            "text": "数字调节框控件",
            "link": "/vbccr/spinbox"
          },
          {
            "text": "状态栏控件",
            "link": "/vbccr/statusbar"
          },
          {
            "text": "系统信息控件",
            "link": "/vbccr/sysinfo"
          },
          {
            "text": "选项卡控件",
            "link": "/vbccr/tabstrip"
          },
          {
            "text": "文本框控件",
            "link": "/vbccr/textbox"
          },
          {
            "text": "定时器控件",
            "link": "/vbccr/timer"
          },
          {
            "text": "工具栏控件",
            "link": "/vbccr/toolbar"
          },
          {
            "text": "树形视图控件",
            "link": "/vbccr/treeview"
          },
          {
            "text": "上下调节控件",
            "link": "/vbccr/updown"
          },
          {
            "text": "虚拟组合框控件",
            "link": "/vbccr/virtualcombo"
          },
          {
            "text": "虚拟列表框控件",
            "link": "/vbccr/vlistbox"
          },
          {
            "text": "窗口化标签控件",
            "link": "/vbccr/windowedlabel"
          },
          {
            "text": "官方文档",
            "link": "/vbccr/readme"
          }
        ]
      }
    ],
    "/vbman/": [
      {
        "text": "VBMAN 文档",
        "items": [
          {
            "text": "介绍",
            "link": "/vbman/"
          },
          {
            "text": "日志",
            "link": "/vbman/start/devlog"
          },
          {
            "text": "示例",
            "collapsed": false,
            "items": [
              {
                "text": "Hello World",
                "link": "/vbman/demo/1.HelloWorld"
              },
              {
                "text": "Web 根目录",
                "link": "/vbman/demo/2.Webroot"
              },
              {
                "text": "数据库",
                "link": "/vbman/demo/3.Database"
              },
              {
                "text": "JSON",
                "link": "/vbman/demo/4.cJson"
              },
              {
                "text": "中间件",
                "link": "/vbman/demo/5.MiddleWare"
              },
              {
                "text": "SSE",
                "link": "/vbman/demo/6.SSE"
              },
              {
                "text": "SSE2",
                "link": "/vbman/demo/7.SSE2"
              },
              {
                "text": "WebSocket",
                "link": "/vbman/demo/8.WebSocket"
              },
              {
                "text": "API调用",
                "link": "/vbman/demo/9.ApiCall"
              },
              {
                "text": "多进程",
                "link": "/vbman/demo/10.Multiprocessor"
              },
              {
                "text": "网络数据展示",
                "link": "/vbman/demo/11.NetDataShow"
              },
              {
                "text": "后台管理",
                "link": "/vbman/demo/12.AdminEnd"
              },
              {
                "text": "天气预报",
                "link": "/vbman/demo/13.Weather"
              }
            ]
          }
        ]
      }
    ],
    "/vbman2/": [
      {
        "text": "VBMAN2 文档",
        "items": [
          {
            "text": "介绍",
            "link": "/vbman2/index"
          },
          {
            "text": "已知问题",
            "link": "/vbman2/start/issus"
          },
          {
            "text": "核心功能",
            "link": "/vbman2/core"
          },
          {
            "text": "事件参考",
            "link": "/vbman2/events"
          },
          {
            "text": "设置配置",
            "link": "/vbman2/settings"
          },
          {
            "text": "高级功能",
            "link": "/vbman2/advanced"
          },
          {
            "text": "进程管理",
            "link": "/vbman2/process"
          }
        ]
      }
    ]
  },
  "footer": {
    "message": "VB6及其LOGO版权为微软公司所有",
    "copyright": "VBMAN 版权所有 © 2019-2025 邓伟"
  },
  "docFooter": {
    "prev": "上一页",
    "next": "下一页"
  },
  "lastUpdated": {
    "text": "最后更新",
    "formatOptions": {
      "dateStyle": "short",
      "timeStyle": "short",
      "timeZone": "Asia/Shanghai"
    }
  }
}

Page Data

{
  "title": "Runtime API Examples",
  "description": "",
  "frontmatter": {
    "outline": "deep"
  },
  "headers": [],
  "relativePath": "demo/api-examples.md",
  "filePath": "demo/api-examples.md",
  "lastUpdated": 1746428702000
}

Page Frontmatter

{
  "outline": "deep"
}

More

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

最后更新:

VB6及其LOGO版权为微软公司所有