Skip to content
ON THIS PAGE

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": "ON THIS PAGE",
  "lastUpdatedText": "Last updated",
  "editLink": {
    "text": "Edit this page on GitHub",
    "pattern": "https://github.com/SaarChaffee/AzurLaneAutoScriptWiki/edit/master/:path"
  },
  "docFooter": {
    "prev": "Previous",
    "next": "Next"
  },
  "docsearch": {
    "placeholder": "Search the documentation",
    "translations": {
      "button": {
        "buttonText": "Search",
        "buttonAriaLabel": "Search"
      },
      "modal": {
        "searchBox": {
          "resetButtonTitle": "Clear the query",
          "resetButtonAriaLabel": "Clear the query",
          "cancelButtonText": "Cancel",
          "cancelButtonAriaLabel": "Cancel"
        },
        "startScreen": {
          "recentSearchesTitle": "Recent",
          "noRecentSearchesText": "No recent searches",
          "saveRecentSearchButtonTitle": "Save this search",
          "removeRecentSearchButtonTitle": "Remove this search from history",
          "favoriteSearchesTitle": "Favorite",
          "removeFavoriteSearchButtonTitle": "Remove from favorites"
        },
        "errorScreen": {
          "titleText": "Unable to fetch results",
          "helpText": "You might want to check your network connection."
        },
        "footer": {
          "selectText": "to select",
          "navigateText": "to navigate",
          "closeText": "to close",
          "searchByText": "search by"
        },
        "noResultsScreen": {
          "noResultsText": "No results for",
          "suggestedQueryText": "Try searching for",
          "reportMissingResultsText": "Believe this query should return results?",
          "reportMissingResultsLinkText": "Let us know."
        }
      }
    }
  },
  "darkModeSwitchLabel": "Appearance",
  "sidebarMenuLabel": "Menu",
  "returnToTopLabel": "Return to top",
  "langMenuLabel": "Change language",
  "navText": "Navi",
  "nav": [
    {
      "text": "Get Started",
      "link": "/en-US/manual/",
      "activeMatch": "^/en-US/manual/"
    },
    {
      "text": "Usage",
      "link": "/en-US/usage/",
      "activeMatch": "^/en-US/usage/"
    },
    {
      "text": "Develop",
      "link": "/en-US/develop/",
      "activeMatch": "^/en-US/develop/"
    },
    {
      "text": "API",
      "link": "/en-US/api/",
      "activeMatch": "^/en-US/api/"
    },
    {
      "text": "Plugins",
      "items": [
        {
          "text": "MAA",
          "link": "/en-US/plugins/maa",
          "activeMatch": "^/en-US/plugins/maa"
        },
        {
          "text": "FGO-Py",
          "link": "/en-US/plugins/fgopy",
          "activeMatch": "^/en-US/plugins/fgopy"
        }
      ],
      "activeMatch": "^/en-US/plugins/"
    }
  ],
  "sidebar": {
    "/en-US/manual/": [
      {
        "text": "",
        "items": [
          {
            "text": "Introduction",
            "link": "/en-US/manual/"
          }
        ]
      },
      {
        "text": "Install",
        "items": [
          {
            "text": "Install on Windows",
            "link": "/en-US/manual/install/windows"
          },
          {
            "text": "Install on MacOS",
            "link": "/en-US/manual/install/macos"
          },
          {
            "text": "Install on Linux",
            "link": "/en-US/manual/install/linux"
          },
          {
            "text": "Install on Android",
            "link": "/en-US/manual/install/android"
          },
          {
            "text": "Use in Docker",
            "link": "/en-US/manual/install/docker"
          }
        ]
      },
      {
        "text": "Get Started",
        "link": "/en-US/manual/quick-start/",
        "items": [
          {
            "text": "Directory Structure",
            "link": "/en-US/manual/quick-start/folder"
          },
          {
            "text": "UI",
            "link": "/en-US/manual/quick-start/ui"
          },
          {
            "text": "Basic Config",
            "link": "/en-US/manual/quick-start/config"
          },
          {
            "text": "Scheduler",
            "link": "/en-US/manual/quick-start/scheduler"
          },
          {
            "text": "Filter",
            "link": "/en-US/manual/quick-start/filter"
          },
          {
            "text": "Message Push",
            "link": "/en-US/manual/quick-start/message-push"
          },
          {
            "text": "Remote Control",
            "link": "/en-US/manual/quick-start/remote-control"
          },
          {
            "text": "FAQs",
            "link": "/en-US/manual/quick-start/FAQ"
          },
          {
            "text": "Errors",
            "link": "/en-US/manual/quick-start/normal-errors"
          }
        ]
      },
      {
        "text": "Emulator",
        "items": [
          {
            "text": "Devices Support",
            "link": "/en-US/manual/emulator/emulator-support"
          }
        ]
      },
      {
        "text": "Azur Lane",
        "items": [
          {
            "text": "Game Settings",
            "link": "/en-US/manual/game/game-settings"
          },
          {
            "text": "Knowledge",
            "link": "/en-US/manual/game/azurlane-knowledge"
          },
          {
            "text": "Deprecated Functions",
            "link": "/en-US/manual/game/deprecated"
          }
        ]
      }
    ],
    "/en-US/usage/": [
      {
        "text": "",
        "items": [
          {
            "text": "Overview",
            "link": "/en-US/usage/"
          }
        ]
      },
      {
        "text": "Alas",
        "items": [
          {
            "text": "Alas Settings",
            "link": "/en-US/usage/alas/alas-settings"
          },
          {
            "text": "General Settings",
            "link": "/en-US/usage/alas/general-settings"
          },
          {
            "text": "Restart Settings",
            "link": "/en-US/usage/alas/restart-settings"
          },
          {
            "text": "Filter",
            "link": "/en-US/usage/alas/filter/",
            "items": [
              {
                "text": "Commission Filter",
                "link": "/en-US/usage/alas/filter/commission-filter"
              },
              {
                "text": "Research Filter",
                "link": "/en-US/usage/alas/filter/research-filter"
              },
              {
                "text": "Tactical Filter",
                "link": "/en-US/usage/alas/filter/tactical-filter"
              },
              {
                "text": "Shop Filter",
                "link": "/en-US/usage/alas/filter/shop-filter"
              },
              {
                "text": "Enhance Filter",
                "link": "/en-US/usage/alas/filter/enhance-filter"
              }
            ]
          }
        ]
      },
      {
        "text": "Farm",
        "items": [
          {
            "text": "Campaign",
            "link": "/en-US/usage/farm/campaign"
          },
          {
            "text": "Gems Farming",
            "link": "/en-US/usage/farm/gems-farming"
          },
          {
            "text": "Sos",
            "link": "/en-US/usage/farm/sos"
          }
        ]
      },
      {
        "text": "Event",
        "items": [
          {
            "text": "Event General Settings",
            "link": "/en-US/usage/event/event-general"
          },
          {
            "text": "Event",
            "link": "/en-US/usage/event/event"
          },
          {
            "text": "Raid",
            "link": "/en-US/usage/event/raid"
          },
          {
            "text": "Coalition",
            "link": "/en-US/usage/event/coalition"
          },
          {
            "text": "Maritime Escort",
            "link": "/en-US/usage/event/maritime-escort"
          },
          {
            "text": "War Archives",
            "link": "/en-US/usage/event/war-archives"
          },
          {
            "text": "Event Daily",
            "items": [
              {
                "text": "Event Daily A | B | C | D | SP",
                "link": "/en-US/usage/event/daily/event"
              },
              {
                "text": "Raid Daily",
                "link": "/en-US/usage/event/daily/raid"
              },
              {
                "text": "Frostfall Daily SP",
                "link": "/en-US/usage/event/daily/coalition"
              }
            ]
          }
        ]
      },
      {
        "text": "Reward",
        "items": [
          {
            "text": "Commission",
            "link": "/en-US/usage/reward/commission"
          },
          {
            "text": "Tactical",
            "link": "/en-US/usage/reward/tactical"
          },
          {
            "text": "Research",
            "link": "/en-US/usage/reward/research"
          },
          {
            "text": "Dorm",
            "link": "/en-US/usage/reward/dorm"
          },
          {
            "text": "Meowfficer",
            "link": "/en-US/usage/reward/meowfficer"
          },
          {
            "text": "Guild",
            "link": "/en-US/usage/reward/guild"
          },
          {
            "text": "Reward",
            "link": "/en-US/usage/reward/reward"
          }
        ]
      },
      {
        "text": "Daily",
        "items": [
          {
            "text": "Daily",
            "link": "/en-US/usage/daily/daily"
          },
          {
            "text": "Hard",
            "link": "/en-US/usage/daily/hard"
          },
          {
            "text": "Exercise",
            "link": "/en-US/usage/daily/exercise"
          },
          {
            "text": "Shop Frequent",
            "link": "/en-US/usage/daily/shop-frequent"
          },
          {
            "text": "Shop Once",
            "link": "/en-US/usage/daily/shop-once"
          },
          {
            "text": "Shipyard",
            "link": "/en-US/usage/daily/shipyard"
          },
          {
            "text": "Gacha",
            "link": "/en-US/usage/daily/gacha"
          },
          {
            "text": "Freebies",
            "link": "/en-US/usage/daily/freebies"
          }
        ]
      },
      {
        "text": "Operation Siren",
        "items": [
          {
            "text": "Opsi General Settings",
            "link": "/en-US/usage/opsi/general"
          },
          {
            "text": "Ash Beacon",
            "link": "/en-US/usage/opsi/ash-beacon"
          },
          {
            "text": "OpSi Ash Assist",
            "link": "/en-US/usage/opsi/ash-assist"
          },
          {
            "text": "OpSi Explore",
            "link": "/en-US/usage/opsi/explore"
          },
          {
            "text": "OpSi Shop",
            "link": "/en-US/usage/opsi/shop"
          },
          {
            "text": "OpSi Voucher",
            "link": "/en-US/usage/opsi/voucher"
          },
          {
            "text": "OpSi Daily",
            "link": "/en-US/usage/opsi/daily"
          },
          {
            "text": "Obscure Zones",
            "link": "/en-US/usage/opsi/obscure"
          },
          {
            "text": "Abyssal Zones",
            "link": "/en-US/usage/opsi/abyssal"
          },
          {
            "text": "Archive Zones",
            "link": "/en-US/usage/opsi/archive"
          },
          {
            "text": "Siren Strongholds",
            "link": "/en-US/usage/opsi/stronghold"
          },
          {
            "text": "Month Boss",
            "link": "/en-US/usage/opsi/month-boss"
          },
          {
            "text": "Meowfficer Farming",
            "link": "/en-US/usage/opsi/meowfficer-farming"
          },
          {
            "text": "CL1 Leveling",
            "link": "/en-US/usage/opsi/hazard-1-leveling"
          },
          {
            "text": "Cross Month Daily",
            "link": "/en-US/usage/opsi/cross-mouth"
          }
        ]
      },
      {
        "text": "Tools",
        "items": [
          {
            "text": "Updater",
            "link": "/en-US/usage/tool/updater"
          },
          {
            "text": "Remote Control",
            "link": "/en-US/usage/tool/remote-control"
          },
          {
            "text": "Normal Semi-auto",
            "link": "/en-US/usage/tool/daemon"
          },
          {
            "text": "OpSi Semi-auto",
            "link": "/en-US/usage/tool/opsi-daemon"
          },
          {
            "text": "Performance Test",
            "link": "/en-US/usage/tool/benchmark"
          },
          {
            "text": "Uncensored Patch",
            "link": "/en-US/usage/tool/uncensored"
          },
          {
            "text": "Game Manager",
            "link": "/en-US/usage/tool/game-manager"
          }
        ]
      }
    ],
    "/en-US/develop/": [
      {
        "text": "",
        "items": [
          {
            "text": "Overview",
            "link": "/en-US/develop/"
          }
        ]
      },
      {
        "text": "Get Started",
        "items": [
          {
            "text": "Start",
            "link": "/en-US/develop/start"
          },
          {
            "text": "Beginner",
            "items": [
              {
                "text": "Debugging",
                "link": "/en-US/develop/beginner/debugging"
              },
              {
                "text": "Multi-server Support",
                "link": "/en-US/develop/beginner/multi-server-support"
              }
            ]
          },
          {
            "text": "Elementary",
            "items": [
              {
                "text": "Utils",
                "link": "/en-US/develop/elementary/utils"
              },
              {
                "text": "Decorators",
                "link": "/en-US/develop/elementary/decorators"
              },
              {
                "text": "Logger",
                "link": "/en-US/develop/elementary/log"
              },
              {
                "text": "Exception",
                "link": "/en-US/develop/elementary/exception"
              }
            ]
          },
          {
            "text": "Intermediate",
            "items": [
              {
                "text": "Detection",
                "link": "/en-US/develop/intermediate/detection"
              },
              {
                "text": "UI Control",
                "link": "/en-US/develop/intermediate/ui-control"
              },
              {
                "text": "OCR",
                "link": "/en-US/develop/intermediate/ocr"
              }
            ]
          },
          {
            "text": "Advance",
            "items": [
              {
                "text": "Local Map",
                "link": "/en-US/develop/advance/local-map"
              },
              {
                "text": "Create Globe Map",
                "link": "/en-US/develop/advance/create-globe-map"
              },
              {
                "text": "Globe Map",
                "link": "/en-US/develop/advance/globe-map"
              }
            ]
          },
          {
            "text": "Alas GUI",
            "items": [
              {
                "text": "Generate GUI Settings",
                "link": "/en-US/develop/gui/gui-option"
              }
            ]
          },
          {
            "text": "Perspective",
            "link": "/en-US/develop/perspective.md"
          },
          {
            "text": "PR steps",
            "link": "/en-US/develop/PR-steps.md"
          }
        ]
      },
      {
        "text": "Documentation",
        "items": [
          {
            "text": "API Example",
            "link": "/en-US/develop/doc/api-exp"
          },
          {
            "text": "Markdown Example",
            "link": "/en-US/develop/doc/md-exp"
          }
        ]
      }
    ],
    "/en-US/api/": [
      {
        "text": "",
        "items": [
          {
            "text": "Overview",
            "link": "/en-US/api/"
          }
        ]
      }
    ]
  }
}

Page Data

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

Page Frontmatter

{
  "outline": "deep"
}

More

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