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

{
  "outline": [
    2,
    3
  ],
  "label": "简体中文",
  "lang": "zh-CN",
  "themeConfig": {
    "outlineTitle": "目录",
    "lastUpdatedText": "上次更新",
    "editLink": {
      "text": "编辑此页面"
    },
    "docFooter": {
      "prev": "上一页",
      "next": "下一页"
    },
    "docsearch": {
      "placeholder": "搜索文档",
      "translations": {
        "button": {
          "buttonText": "搜索",
          "buttonAriaLabel": "搜索"
        },
        "modal": {
          "searchBox": {
            "resetButtonTitle": "清除查询条件",
            "resetButtonAriaLabel": "清除查询条件",
            "cancelButtonText": "取消",
            "cancelButtonAriaLabel": "取消"
          },
          "startScreen": {
            "recentSearchesTitle": "搜索历史",
            "noRecentSearchesText": "没有搜索历史",
            "saveRecentSearchButtonTitle": "保存至搜索历史",
            "removeRecentSearchButtonTitle": "从搜索历史中移除",
            "favoriteSearchesTitle": "收藏",
            "removeFavoriteSearchButtonTitle": "从收藏中移除"
          },
          "errorScreen": {
            "titleText": "无法获取结果",
            "helpText": "你可能需要检查你的网络连接"
          },
          "footer": {
            "selectText": "选择",
            "navigateText": "切换",
            "closeText": "关闭",
            "searchByText": "搜索提供者"
          },
          "noResultsScreen": {
            "noResultsText": "无法找到相关结果",
            "suggestedQueryText": "你可以尝试查询",
            "reportMissingResultsText": "你认为该查询应该有结果?",
            "reportMissingResultsLinkText": "点击反馈"
          }
        }
      }
    },
    "darkModeSwitchLabel": "外观",
    "sidebarMenuLabel": "菜单",
    "returnToTopLabel": "返回顶部",
    "langMenuLabel": "语言"
  },
  "indexName": "wiki",
  "logo": "/icon.ico",
  "socialLinks": [
    {
      "icon": "github",
      "link": "https://github.com/LmeSzinc/AzurLaneAutoScript"
    }
  ],
  "crowdin": null,
  "outlineTitle": "目录",
  "lastUpdatedText": "上次更新",
  "editLink": {
    "text": "在 GitHub 编辑此页面",
    "pattern": "https://github.com/SaarChaffee/AzurLaneAutoScriptWiki/edit/master/:path"
  },
  "docFooter": {
    "prev": "上一页",
    "next": "下一页"
  },
  "docsearch": {
    "placeholder": "搜索文档",
    "translations": {
      "button": {
        "buttonText": "搜索",
        "buttonAriaLabel": "搜索"
      },
      "modal": {
        "searchBox": {
          "resetButtonTitle": "清除查询条件",
          "resetButtonAriaLabel": "清除查询条件",
          "cancelButtonText": "取消",
          "cancelButtonAriaLabel": "取消"
        },
        "startScreen": {
          "recentSearchesTitle": "搜索历史",
          "noRecentSearchesText": "没有搜索历史",
          "saveRecentSearchButtonTitle": "保存至搜索历史",
          "removeRecentSearchButtonTitle": "从搜索历史中移除",
          "favoriteSearchesTitle": "收藏",
          "removeFavoriteSearchButtonTitle": "从收藏中移除"
        },
        "errorScreen": {
          "titleText": "无法获取结果",
          "helpText": "你可能需要检查你的网络连接"
        },
        "footer": {
          "selectText": "选择",
          "navigateText": "切换",
          "closeText": "关闭",
          "searchByText": "搜索提供者"
        },
        "noResultsScreen": {
          "noResultsText": "无法找到相关结果",
          "suggestedQueryText": "你可以尝试查询",
          "reportMissingResultsText": "你认为该查询应该有结果?",
          "reportMissingResultsLinkText": "点击反馈"
        }
      }
    }
  },
  "darkModeSwitchLabel": "外观",
  "sidebarMenuLabel": "菜单",
  "returnToTopLabel": "返回顶部",
  "langMenuLabel": "语言",
  "navText": "导航",
  "nav": [
    {
      "text": "入门",
      "link": "/zh-CN/manual/",
      "activeMatch": "^/zh-CN/manual/"
    },
    {
      "text": "使用",
      "link": "/zh-CN/usage/",
      "activeMatch": "^/zh-CN/usage/"
    },
    {
      "text": "开发",
      "link": "/zh-CN/develop/",
      "activeMatch": "^/zh-CN/develop/"
    },
    {
      "text": "API",
      "link": "/zh-CN/api/",
      "activeMatch": "^/zh-CN/api/"
    },
    {
      "text": "插件",
      "items": [
        {
          "text": "MAA",
          "link": "/zh-CN/plugins/maa",
          "activeMatch": "^/zh-CN/plugins/maa"
        },
        {
          "text": "FGO-Py",
          "link": "/zh-CN/plugins/fgopy",
          "activeMatch": "^/zh-CN/plugins/fgopy"
        }
      ],
      "activeMatch": "^/zh-CN/plugins/"
    }
  ],
  "sidebar": {
    "/zh-CN/manual/": [
      {
        "text": "",
        "items": [
          {
            "text": "介绍",
            "link": "/zh-CN/manual/"
          }
        ]
      },
      {
        "text": "安装",
        "items": [
          {
            "text": "在 Windows 中安装",
            "link": "/zh-CN/manual/install/windows"
          },
          {
            "text": "在 MacOS 中安装",
            "link": "/zh-CN/manual/install/macos"
          },
          {
            "text": "在 Linux 中安装",
            "link": "/zh-CN/manual/install/linux"
          },
          {
            "text": "在 Android 中安装",
            "link": "/zh-CN/manual/install/android"
          },
          {
            "text": "在容器中安装",
            "link": "/zh-CN/manual/install/docker"
          }
        ]
      },
      {
        "text": "快速上手",
        "link": "/zh-CN/manual/quick-start/",
        "items": [
          {
            "text": "目录内容",
            "link": "/zh-CN/manual/quick-start/folder"
          },
          {
            "text": "界面",
            "link": "/zh-CN/manual/quick-start/ui"
          },
          {
            "text": "基础配置",
            "link": "/zh-CN/manual/quick-start/config"
          },
          {
            "text": "调度器",
            "link": "/zh-CN/manual/quick-start/scheduler"
          },
          {
            "text": "过滤器",
            "link": "/zh-CN/manual/quick-start/filter"
          },
          {
            "text": "消息推送",
            "link": "/zh-CN/manual/quick-start/message-push"
          },
          {
            "text": "远程控制",
            "link": "/zh-CN/manual/quick-start/remote-control"
          },
          {
            "text": "常见问题",
            "link": "/zh-CN/manual/quick-start/FAQ"
          },
          {
            "text": "常见错误",
            "link": "/zh-CN/manual/quick-start/normal-errors"
          }
        ]
      },
      {
        "text": "模拟器相关",
        "items": [
          {
            "text": "设备支持文档",
            "link": "/zh-CN/manual/emulator/emulator-support"
          }
        ]
      },
      {
        "text": "游戏相关",
        "items": [
          {
            "text": "游戏设置",
            "link": "/zh-CN/manual/game/game-settings"
          },
          {
            "text": "碧蓝航线知识",
            "link": "/zh-CN/manual/game/azurlane-knowledge"
          },
          {
            "text": "已废除功能",
            "link": "/zh-CN/manual/game/deprecated"
          }
        ]
      }
    ],
    "/zh-CN/usage/": [
      {
        "text": "",
        "items": [
          {
            "text": "总览",
            "link": "/zh-CN/usage/"
          }
        ]
      },
      {
        "text": "Alas",
        "items": [
          {
            "text": "Alas 设置",
            "link": "/zh-CN/usage/alas/alas-settings"
          },
          {
            "text": "通用设置",
            "link": "/zh-CN/usage/alas/general-settings"
          },
          {
            "text": "重启设置",
            "link": "/zh-CN/usage/alas/restart-settings"
          },
          {
            "text": "过滤器",
            "link": "/zh-CN/usage/alas/filter/",
            "items": [
              {
                "text": "委托过滤器",
                "link": "/zh-CN/usage/alas/filter/commission-filter"
              },
              {
                "text": "科研过滤器",
                "link": "/zh-CN/usage/alas/filter/research-filter"
              },
              {
                "text": "战术学院过滤器",
                "link": "/zh-CN/usage/alas/filter/tactical-filter"
              },
              {
                "text": "商店过滤器",
                "link": "/zh-CN/usage/alas/filter/shop-filter"
              },
              {
                "text": "强化舰船过滤器",
                "link": "/zh-CN/usage/alas/filter/enhance-filter"
              }
            ]
          }
        ]
      },
      {
        "text": "出击",
        "items": [
          {
            "text": "主线图",
            "link": "/zh-CN/usage/farm/campaign"
          },
          {
            "text": "刷紧急委托",
            "link": "/zh-CN/usage/farm/gems-farming"
          },
          {
            "text": "潜艇图",
            "link": "/zh-CN/usage/farm/sos"
          }
        ]
      },
      {
        "text": "活动",
        "items": [
          {
            "text": "活动通用设置",
            "link": "/zh-CN/usage/event/event-general"
          },
          {
            "text": "活动图",
            "link": "/zh-CN/usage/event/event"
          },
          {
            "text": "共斗活动",
            "link": "/zh-CN/usage/event/raid"
          },
          {
            "text": "极地风暴",
            "link": "/zh-CN/usage/event/coalition"
          },
          {
            "text": "商船护航",
            "link": "/zh-CN/usage/event/maritime-escort"
          },
          {
            "text": "作战档案",
            "link": "/zh-CN/usage/event/war-archives"
          },
          {
            "text": "活动每日",
            "items": [
              {
                "text": "活动每日A | B | C | D | SP图",
                "link": "/zh-CN/usage/event/daily/event"
              },
              {
                "text": "共斗每日",
                "link": "/zh-CN/usage/event/daily/raid"
              },
              {
                "text": "极地风暴每日SP",
                "link": "/zh-CN/usage/event/daily/coalition"
              }
            ]
          }
        ]
      },
      {
        "text": "收获",
        "items": [
          {
            "text": "委托",
            "link": "/zh-CN/usage/reward/commission"
          },
          {
            "text": "战术学院",
            "link": "/zh-CN/usage/reward/tactical"
          },
          {
            "text": "科研",
            "link": "/zh-CN/usage/reward/research"
          },
          {
            "text": "后宅",
            "link": "/zh-CN/usage/reward/dorm"
          },
          {
            "text": "指挥喵",
            "link": "/zh-CN/usage/reward/meowfficer"
          },
          {
            "text": "大舰队",
            "link": "/zh-CN/usage/reward/guild"
          },
          {
            "text": "收获",
            "link": "/zh-CN/usage/reward/reward"
          }
        ]
      },
      {
        "text": "每日任务",
        "items": [
          {
            "text": "每日任务",
            "link": "/zh-CN/usage/daily/daily"
          },
          {
            "text": "困难图",
            "link": "/zh-CN/usage/daily/hard"
          },
          {
            "text": "演习",
            "link": "/zh-CN/usage/daily/exercise"
          },
          {
            "text": "通用商店",
            "link": "/zh-CN/usage/daily/shop-frequent"
          },
          {
            "text": "其他商店",
            "link": "/zh-CN/usage/daily/shop-once"
          },
          {
            "text": "开发船坞",
            "link": "/zh-CN/usage/daily/shipyard"
          },
          {
            "text": "每日抽卡",
            "link": "/zh-CN/usage/daily/gacha"
          },
          {
            "text": "白嫖奖励",
            "link": "/zh-CN/usage/daily/freebies"
          }
        ]
      },
      {
        "text": "大世界",
        "items": [
          {
            "text": "通用设置",
            "link": "/zh-CN/usage/opsi/general"
          },
          {
            "text": "余烬信标",
            "link": "/zh-CN/usage/opsi/ash-beacon"
          },
          {
            "text": "信标支援",
            "link": "/zh-CN/usage/opsi/ash-assist"
          },
          {
            "text": "每月开荒",
            "link": "/zh-CN/usage/opsi/explore"
          },
          {
            "text": "大世界商店",
            "link": "/zh-CN/usage/opsi/shop"
          },
          {
            "text": "兑换商店",
            "link": "/zh-CN/usage/opsi/voucher"
          },
          {
            "text": "大世界每日",
            "link": "/zh-CN/usage/opsi/daily"
          },
          {
            "text": "隐秘海域",
            "link": "/zh-CN/usage/opsi/obscure"
          },
          {
            "text": "深渊海域",
            "link": "/zh-CN/usage/opsi/abyssal"
          },
          {
            "text": "档案坐标",
            "link": "/zh-CN/usage/opsi/archive"
          },
          {
            "text": "塞壬要塞",
            "link": "/zh-CN/usage/opsi/stronghold"
          },
          {
            "text": "月度Boss",
            "link": "/zh-CN/usage/opsi/month-boss"
          },
          {
            "text": "短猫相接",
            "link": "/zh-CN/usage/opsi/meowfficer-farming"
          },
          {
            "text": "侵蚀1练级",
            "link": "/zh-CN/usage/opsi/hazard-1-leveling"
          },
          {
            "text": "跨月每日",
            "link": "/zh-CN/usage/opsi/cross-mouth"
          }
        ]
      },
      {
        "text": "工具",
        "items": [
          {
            "text": "更新器",
            "link": "/zh-CN/usage/tool/updater"
          },
          {
            "text": "远程控制",
            "link": "/zh-CN/usage/tool/remote-control"
          },
          {
            "text": "半自动点击",
            "link": "/zh-CN/usage/tool/daemon"
          },
          {
            "text": "大世界半自动",
            "link": "/zh-CN/usage/tool/opsi-daemon"
          },
          {
            "text": "性能测试",
            "link": "/zh-CN/usage/tool/benchmark"
          },
          {
            "text": "反和谐",
            "link": "/zh-CN/usage/tool/uncensored"
          },
          {
            "text": "游戏管理器",
            "link": "/zh-CN/usage/tool/game-manager"
          }
        ]
      }
    ],
    "/zh-CN/develop/": [
      {
        "text": "",
        "items": [
          {
            "text": "总览",
            "link": "/zh-CN/develop/"
          }
        ]
      },
      {
        "text": "开发教程",
        "items": [
          {
            "text": "梦开始的地方",
            "link": "/zh-CN/develop/start"
          },
          {
            "text": "起步",
            "items": [
              {
                "text": "调试",
                "link": "/zh-CN/develop/beginner/debugging"
              },
              {
                "text": "多服务器支持",
                "link": "/zh-CN/develop/beginner/multi-server-support"
              }
            ]
          },
          {
            "text": "基础",
            "items": [
              {
                "text": "工具类",
                "link": "/zh-CN/develop/elementary/utils"
              },
              {
                "text": "装饰器",
                "link": "/zh-CN/develop/elementary/decorators"
              },
              {
                "text": "日志",
                "link": "/zh-CN/develop/elementary/log"
              },
              {
                "text": "异常",
                "link": "/zh-CN/develop/elementary/exception"
              }
            ]
          },
          {
            "text": "中级",
            "items": [
              {
                "text": "用于识别的类",
                "link": "/zh-CN/develop/intermediate/detection"
              },
              {
                "text": "操作游戏界面的类和方法",
                "link": "/zh-CN/develop/intermediate/ui-control"
              },
              {
                "text": "光学字符识别",
                "link": "/zh-CN/develop/intermediate/ocr"
              },
              {
                "text": "条件循环",
                "link": "/zh-CN/develop/intermediate/state-loop"
              }
            ]
          },
          {
            "text": "高级",
            "items": [
              {
                "text": "地图识别",
                "link": "/zh-CN/develop/advance/local-map"
              },
              {
                "text": "创建全局地图",
                "link": "/zh-CN/develop/advance/create-globe-map"
              },
              {
                "text": "全局地图",
                "link": "/zh-CN/develop/advance/globe-map"
              }
            ]
          },
          {
            "text": "Alas 界面",
            "items": [
              {
                "text": "生成 GUI 设置",
                "link": "/zh-CN/develop/gui/gui-option"
              }
            ]
          },
          {
            "text": "海图识别",
            "link": "/zh-CN/develop/perspective.md"
          },
          {
            "text": "PR流程简述",
            "link": "/zh-CN/develop/PR-steps.md"
          }
        ]
      },
      {
        "text": "维护文档",
        "items": [
          {
            "text": "api样例",
            "link": "/zh-CN/develop/doc/api-exp"
          },
          {
            "text": "Markdown样例",
            "link": "/zh-CN/develop/doc/md-exp"
          }
        ]
      }
    ],
    "/zh-CN/api/": [
      {
        "text": "",
        "items": [
          {
            "text": "总览",
            "link": "/zh-CN/api/"
          }
        ]
      }
    ]
  }
}

Page Data

{
  "title": "Runtime API Examples",
  "description": "",
  "frontmatter": {
    "outline": "deep"
  },
  "headers": [],
  "relativePath": "zh-CN/develop/doc/api-exp.md",
  "filePath": "zh-CN/develop/doc/api-exp.md"
}

Page Frontmatter

{
  "outline": "deep"
}

More

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