代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Runtime API Examples | blogpress</title>
<meta name="description" content="A VitePress Site">
<meta name="generator" content="VitePress v1.2.3">
<link rel="preload stylesheet" href="/blogpress/assets/style.BdLtO6Aj.css" as="style">
<script type="module" src="/blogpress/assets/app.BctlEfuu.js"></script>
<link rel="preload" href="/blogpress/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
<link rel="modulepreload" href="/blogpress/assets/chunks/framework.omHbCO-K.js">
<link rel="modulepreload" href="/blogpress/assets/chunks/theme.DzuxbxFK.js">
<link rel="modulepreload" href="/blogpress/assets/api-examples.md.BAZi0dgj.lean.js">
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
</head>
<body>
<div id="app"><div class="Layout" data-v-592c8d3e><!--[--><!--]--><!--[--><span tabindex="-1" data-v-a162ca81></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-a162ca81> Skip to content </a><!--]--><!----><header class="VPNav" data-v-592c8d3e data-v-00328064><div class="VPNavBar has-sidebar top" data-v-00328064 data-v-94f61116><div class="wrapper" data-v-94f61116><div class="container" data-v-94f61116><div class="title" data-v-94f61116><div class="VPNavBarTitle has-sidebar" data-v-94f61116 data-v-8416f609><a class="title" href="/blogpress/" data-v-8416f609><!--[--><!--]--><!----><span data-v-8416f609>blogpress</span><!--[--><!--]--></a></div></div><div class="content" data-v-94f61116><div class="content-body" data-v-94f61116><!--[--><!--]--><div class="VPNavBarSearch search" data-v-94f61116><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-94f61116 data-v-9311c1b6><span id="main-nav-aria-label" class="visually-hidden" data-v-9311c1b6>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/blogpress/" tabindex="0" data-v-9311c1b6 data-v-bc9bf9bd><!--[--><span data-v-bc9bf9bd>首页</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/blogpress/markdown-examples.html" tabindex="0" data-v-9311c1b6 data-v-bc9bf9bd><!--[--><span data-v-bc9bf9bd>示例</span><!--]--></a><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-94f61116 data-v-39afc0b8><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-39afc0b8 data-v-d4008b19 data-v-c0b45f5e><span class="check" data-v-c0b45f5e><span class="icon" data-v-c0b45f5e><!--[--><span class="vpi-sun sun" data-v-d4008b19></span><span class="vpi-moon moon" data-v-d4008b19></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-94f61116 data-v-62046b3f data-v-8c8f502c><!--[--><a class="VPSocialLink no-icon" href="https://github.com/vuejs/vitepress" aria-label="github" target="_blank" rel="noopener" data-v-8c8f502c data-v-ed41da77><span class="vpi-social-github" /></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-94f61116 data-v-c164b318 data-v-b99fa961><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-b99fa961><span class="vpi-more-horizontal icon" data-v-b99fa961></span></button><div class="menu" data-v-b99fa961><div class="VPMenu" data-v-b99fa961 data-v-0b4b08e4><!----><!--[--><!--[--><!----><div class="group" data-v-c164b318><div class="item appearance" data-v-c164b318><p class="label" data-v-c164b318>Appearance</p><div class="appearance-action" data-v-c164b318><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-c164b318 data-v-d4008b19 data-v-c0b45f5e><span class="check" data-v-c0b45f5e><span class="icon" data-v-c0b45f5e><!--[--><span class="vpi-sun sun" data-v-d4008b19></span><span class="vpi-moon moon" data-v-d4008b19></span><!--]--></span></span></button></div></div></div><div class="group" data-v-c164b318><div class="item social-links" data-v-c164b318><div class="VPSocialLinks social-links-list" data-v-c164b318 data-v-8c8f502c><!--[--><a class="VPSocialLink no-icon" href="https://github.com/vuejs/vitepress" aria-label="github" target="_blank" rel="noopener" data-v-8c8f502c data-v-ed41da77><span class="vpi-social-github" /></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-94f61116 data-v-b98622c3><span class="container" data-v-b98622c3><span class="top" data-v-b98622c3></span><span class="middle" data-v-b98622c3></span><span class="bottom" data-v-b98622c3></span></span></button></div></div></div></div><div class="divider" data-v-94f61116><div class="divider-line" data-v-94f61116></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-592c8d3e data-v-72104b40><div class="container" data-v-72104b40><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-72104b40><span class="vpi-align-left menu-icon" data-v-72104b40></span><span class="menu-text" data-v-72104b40>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-72104b40 data-v-52624e8c><button data-v-52624e8c>Return to top</button><!----></div></div></div><aside class="VPSidebar" data-v-592c8d3e data-v-10fec1b3><div class="curtain" data-v-10fec1b3></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-10fec1b3><span class="visually-hidden" id="sidebar-aria-label" data-v-10fec1b3> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-10fec1b3><section class="VPSidebarItem level-0 has-active" data-v-10fec1b3 data-v-608d4383><div class="item" role="button" tabindex="0" data-v-608d4383><div class="indicator" data-v-608d4383></div><h2 class="text" data-v-608d4383>示例</h2><!----></div><div class="items" data-v-608d4383><!--[--><div class="VPSidebarItem level-1 is-link" data-v-608d4383 data-v-608d4383><div class="item" data-v-608d4383><div class="indicator" data-v-608d4383></div><a class="VPLink link link" href="/blogpress/markdown-examples.html" data-v-608d4383><!--[--><p class="text" data-v-608d4383>Markdown Examples</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-608d4383 data-v-608d4383><div class="item" data-v-608d4383><div class="indicator" data-v-608d4383></div><a class="VPLink link link" href="/blogpress/api-examples.html" data-v-608d4383><!--[--><p class="text" data-v-608d4383>Runtime API Examples</p><!--]--></a><!----></div><!----></div><section class="VPSidebarItem level-1" data-v-608d4383 data-v-608d4383><div class="item" role="button" tabindex="0" data-v-608d4383><div class="indicator" data-v-608d4383></div><h3 class="text" data-v-608d4383>cesium</h3><!----></div><div class="items" data-v-608d4383><!--[--><div class="VPSidebarItem level-2 is-link" data-v-608d4383 data-v-608d4383><div class="item" data-v-608d4383><div class="indicator" data-v-608d4383></div><a class="VPLink link link" href="/blogpress/cesium/init/init.html" data-v-608d4383><!--[--><p class="text" data-v-608d4383>初始化</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-608d4383 data-v-608d4383><div class="item" data-v-608d4383><div class="indicator" data-v-608d4383></div><a class="VPLink link link" href="/blogpress/cesium/mapLayer.html" data-v-608d4383><!--[--><p class="text" data-v-608d4383>地图</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-608d4383 data-v-608d4383><div class="item" data-v-608d4383><div class="indicator" data-v-608d4383></div><a class="VPLink link link" href="/blogpress/cesium/popup.html" data-v-608d4383><!--[--><p class="text" data-v-608d4383>弹框</p><!--]--></a><!----></div><!----></div><section class="VPSidebarItem level-2" data-v-608d4383 data-v-608d4383><div class="item" role="button" tabindex="0" data-v-608d4383><div class="indicator" data-v-608d4383></div><h4 class="text" data-v-608d4383>图层</h4><!----></div><div class="items" data-v-608d4383><!--[--><div class="VPSidebarItem level-3 is-link" data-v-608d4383 data-v-608d4383><div class="item" data-v-608d4383><div class="indicator" data-v-608d4383></div><a class="VPLink link link" href="/blogpress/cesium/layer/geojson.html" data-v-608d4383><!--[--><p class="text" data-v-608d4383>geojson</p><!--]--></a><!----></div><!----></div><!--]--></div></section><!--]--></div></section><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-592c8d3e data-v-9c71c868><div class="VPDoc has-sidebar has-aside" data-v-9c71c868 data-v-6294e0c5><!--[--><!--]--><div class="container" data-v-6294e0c5><div class="aside" data-v-6294e0c5><div class="aside-curtain" data-v-6294e0c5></div><div class="aside-container" data-v-6294e0c5><div class="aside-content" data-v-6294e0c5><div class="VPDocAside" data-v-6294e0c5 data-v-2595c546><!--[--><!--]--><!--[--><!--]--><nav aria-labelledby="doc-outline-aria-label" class="VPDocAsideOutline" data-v-2595c546 data-v-aea4b6fd><div class="content" data-v-aea4b6fd><div class="outline-marker" data-v-aea4b6fd></div><div aria-level="2" class="outline-title" id="doc-outline-aria-label" role="heading" data-v-aea4b6fd>On this page</div><ul class="VPDocOutlineItem root" data-v-aea4b6fd data-v-bbc6d299><!--[--><!--]--></ul></div></nav><!--[--><!--]--><div class="spacer" data-v-2595c546></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-6294e0c5><div class="content-container" data-v-6294e0c5><!--[--><!--]--><main class="main" data-v-6294e0c5><div style="position:relative;" class="vp-doc _blogpress_api-examples" data-v-6294e0c5><div><h1 id="runtime-api-examples" tabindex="-1">Runtime API Examples <a class="header-anchor" href="#runtime-api-examples" aria-label="Permalink to "Runtime API Examples""></a></h1><p>This page demonstrates usage of some of the runtime APIs provided by VitePress.</p><p>The main <code>useData()</code> API can be used to access site, theme, and page data for the current page. It works in both <code>.md</code> and <code>.vue</code> files:</p><div class="language-md vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">md</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">script</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> setup</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { useData } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> 'vitepress'</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">const</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">theme</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">page</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">frontmatter</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> useData</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"></</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">script</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;--shiki-light-font-weight:bold;--shiki-dark-font-weight:bold;">## Results</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;--shiki-light-font-weight:bold;--shiki-dark-font-weight:bold;">### Theme Data</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">pre</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>{{ theme }}</</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">pre</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">### Page Data</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">pre</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>{{ page }}</</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">pre</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">### Page Frontmatter</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"><</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">pre</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">>{{ frontmatter }}</</span><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">pre</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">></span></span></code></pre></div><h2 id="results" tabindex="-1">Results <a class="header-anchor" href="#results" aria-label="Permalink to "Results""></a></h2><h3 id="theme-data" tabindex="-1">Theme Data <a class="header-anchor" href="#theme-data" aria-label="Permalink to "Theme Data""></a></h3><pre>{
"nav": [
{
"text": "首页",
"link": "/"
},
{
"text": "示例",
"link": "/markdown-examples"
}
],
"sidebar": [
{
"text": "示例",
"items": [
{
"text": "Markdown Examples",
"link": "/markdown-examples"
},
{
"text": "Runtime API Examples",
"link": "/api-examples"
},
{
"text": "cesium",
"items": [
{
"text": "初始化",
"link": "/cesium/init/init"
},
{
"text": "地图",
"link": "/cesium/mapLayer"
},
{
"text": "弹框",
"link": "/cesium/popup"
},
{
"text": "图层",
"items": [
{
"text": "geojson",
"link": "/cesium/layer/geojson"
}
]
}
]
}
]
}
],
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/vuejs/vitepress"
}
]
}</pre><h3 id="page-data" tabindex="-1">Page Data <a class="header-anchor" href="#page-data" aria-label="Permalink to "Page Data""></a></h3><pre>{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md"
}</pre><h3 id="page-frontmatter" tabindex="-1">Page Frontmatter <a class="header-anchor" href="#page-frontmatter" aria-label="Permalink to "Page Frontmatter""></a></h3><pre>{
"outline": "deep"
}</pre><h2 id="more" tabindex="-1">More <a class="header-anchor" href="#more" aria-label="Permalink to "More""></a></h2><p>Check out the documentation for the <a href="https://vitepress.dev/reference/runtime-api#usedata" target="_blank" rel="noreferrer">full list of runtime APIs</a>.</p></div></div></main><footer class="VPDocFooter" data-v-6294e0c5 data-v-b61b7de4><!--[--><!--]--><!----><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-b61b7de4><span class="visually-hidden" id="doc-footer-aria-label" data-v-b61b7de4>Pager</span><div class="pager" data-v-b61b7de4><a class="VPLink link pager-link prev" href="/blogpress/markdown-examples.html" data-v-b61b7de4><!--[--><span class="desc" data-v-b61b7de4>Previous page</span><span class="title" data-v-b61b7de4>Markdown Examples</span><!--]--></a></div><div class="pager" data-v-b61b7de4><a class="VPLink link pager-link next" href="/blogpress/cesium/init/init.html" data-v-b61b7de4><!--[--><span class="desc" data-v-b61b7de4>Next page</span><span class="title" data-v-b61b7de4>初始化</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
<script>window.__VP_HASH_MAP__=JSON.parse("{\"index.md\":\"CwYWMsl_\",\"markdown-examples.md\":\"D5g_xUKo\",\"cesium_maplayer_index.md\":\"CaxBUxO-\",\"api-examples.md\":\"BAZi0dgj\",\"cesium_init_init.md\":\"ePHvTf4u\",\"cesium_popup_index.md\":\"BcDIRzEY\",\"cesium_layer_geojson_index.md\":\"COLNzLP1\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"blogpress\",\"description\":\"A VitePress Site\",\"base\":\"/blogpress/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[{\"text\":\"首页\",\"link\":\"/\"},{\"text\":\"示例\",\"link\":\"/markdown-examples\"}],\"sidebar\":[{\"text\":\"示例\",\"items\":[{\"text\":\"Markdown Examples\",\"link\":\"/markdown-examples\"},{\"text\":\"Runtime API Examples\",\"link\":\"/api-examples\"},{\"text\":\"cesium\",\"items\":[{\"text\":\"初始化\",\"link\":\"/cesium/init/init\"},{\"text\":\"地图\",\"link\":\"/cesium/mapLayer\"},{\"text\":\"弹框\",\"link\":\"/cesium/popup\"},{\"text\":\"图层\",\"items\":[{\"text\":\"geojson\",\"link\":\"/cesium/layer/geojson\"}]}]}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/vuejs/vitepress\"}]},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。