Skip to content

资源

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

{
  "footer": {
    "copyright": "Copyright © 2024 CloseX"
  },
  "nav": [
    {
      "text": "指南",
      "link": "/zh/guidelines"
    },
    {
      "text": "资源",
      "link": "/zh/resources"
    },
    {
      "text": "更多",
      "items": [
        {
          "text": "隐私政策",
          "link": "/zh/privacy"
        },
        {
          "text": "发行说明",
          "link": "/zh/release-note"
        },
        {
          "text": "博客",
          "link": "https://blog.closex.org"
        },
        {
          "text": "CloseX",
          "link": "https://closex.org"
        },
        {
          "text": "联系我们",
          "link": "mailto:fusion-x-one@outlook.com"
        }
      ]
    }
  ],
  "search": {
    "provider": "local",
    "options": {
      "locales": {
        "zh": {
          "translations": {
            "button": {
              "buttonText": "搜索文档",
              "buttonAriaLabel": "搜索文档"
            },
            "modal": {
              "noResultsText": "无法找到相关结果",
              "resetButtonTitle": "清除查询条件",
              "footer": {
                "selectText": "选择",
                "navigateText": "切换",
                "closeText": "关闭"
              }
            }
          }
        },
        "ja": {
          "translations": {
            "button": {
              "buttonText": "文書の検索",
              "buttonAriaLabel": "文書の検索"
            },
            "modal": {
              "noResultsText": "関連する結果が見つかりませんでした",
              "resetButtonTitle": "クエリ条件をクリアする",
              "footer": {
                "selectText": "選ぶ",
                "navigateText": "スイッチ",
                "closeText": "閉鎖"
              }
            }
          }
        }
      }
    }
  },
  "logo": "/img/logo.webp",
  "sidebar": [
    {
      "text": "平台",
      "collapsed": true,
      "items": [
        {
          "text": "针对 桌面设备 设计",
          "link": "/zh/guidelines/platforms/designing-for-desktop"
        },
        {
          "text": "针对 移动端设备 设计",
          "link": "/zh/guidelines/platforms/designing-for-mobile"
        },
        {
          "text": "针对 平板设备 设计",
          "link": "/zh/guidelines/platforms/designing-for-tablet"
        },
        {
          "text": "针对 Safari 设计",
          "link": "/zh/guidelines/platforms/designing-for-safari"
        },
        {
          "text": "针对 Chrome 设计",
          "link": "/zh/guidelines/platforms/designing-for-chrome"
        },
        {
          "text": "针对 大型语言模型 设计",
          "link": "/zh/guidelines/platforms/designing-for-llms"
        }
      ]
    },
    {
      "text": "基础",
      "collapsed": true,
      "items": [
        {
          "text": "品牌",
          "link": "/zh/guidelines/foundations/branding"
        },
        {
          "text": "布局",
          "link": "/zh/guidelines/foundations/layout"
        },
        {
          "text": "字体排印",
          "link": "/zh/guidelines/foundations/typography"
        },
        {
          "text": "图片",
          "link": "/zh/guidelines/foundations/image"
        },
        {
          "text": "颜色",
          "link": "/zh/guidelines/foundations/color"
        },
        {
          "text": "深色模式",
          "link": "/zh/guidelines/foundations/dark-mode"
        }
      ]
    },
    {
      "text": "组件",
      "collapsed": true,
      "items": [
        {
          "text": "内容",
          "link": "/zh/guidelines/components/content"
        },
        {
          "text": "数据图表化",
          "link": "/zh/guidelines/components/charting-data"
        },
        {
          "text": "载入",
          "link": "/zh/guidelines/components/loading"
        },
        {
          "text": "输入",
          "link": "/zh/guidelines/components/input"
        },
        {
          "text": "搜索",
          "link": "/zh/guidelines/components/search"
        },
        {
          "text": "菜单",
          "link": "/zh/guidelines/components/menu"
        }
      ]
    },
    {
      "text": "写作",
      "collapsed": true,
      "items": [
        {
          "text": "Markdown",
          "link": "/zh/guidelines/writing/markdown"
        },
        {
          "text": "Frontmatter",
          "link": "/zh/guidelines/writing/frontmatter"
        },
        {
          "text": "在 Markdown 使用代码",
          "link": "/zh/guidelines/writing/using-code-in-markdown"
        },
        {
          "text": "资源处理",
          "link": "/zh/guidelines/writing/asset-handling"
        },
        {
          "text": "声音",
          "link": "/zh/guidelines/writing/voice"
        },
        {
          "text": "国际化",
          "link": "/zh/guidelines/writing/internationalization"
        }
      ]
    },
    {
      "text": "性能",
      "collapsed": true,
      "items": [
        {
          "text": "部署",
          "link": "/zh/guidelines/performance/deploy"
        },
        {
          "text": "速度测试",
          "link": "/zh/guidelines/performance/speedtest"
        },
        {
          "text": "SEO",
          "link": "/zh/guidelines/performance/seo"
        },
        {
          "text": "用户体验",
          "link": "/zh/guidelines/performance/user-experience"
        }
      ]
    },
    {
      "text": "自定义",
      "collapsed": true,
      "items": [
        {
          "text": "介绍",
          "link": "/zh/guidelines/customization/profile"
        },
        {
          "text": "CSS",
          "link": "/zh/guidelines/customization/css"
        },
        {
          "text": "Javascript",
          "link": "/zh/guidelines/customization/javascript"
        },
        {
          "text": "友情链接",
          "link": "/zh/guidelines/customization/friendlink"
        },
        {
          "text": "页脚",
          "link": "/zh/guidelines/customization/footer"
        },
        {
          "text": "导航栏",
          "link": "/zh/guidelines/customization/navigation-bar"
        }
      ]
    }
  ],
  "outline": {
    "label": "页面导航"
  },
  "docFooter": {
    "prev": "上一页",
    "next": "下一页"
  },
  "lastUpdated": {
    "text": "最后更新于",
    "formatOptions": {
      "dateStyle": "short",
      "timeStyle": "medium"
    }
  },
  "langMenuLabel": "多语言",
  "returnToTopLabel": "回到顶部",
  "sidebarMenuLabel": "菜单",
  "darkModeSwitchLabel": "主题",
  "lightModeSwitchTitle": "切换到浅色模式",
  "darkModeSwitchTitle": "切换到深色模式"
}

Page Data

{
  "title": "资源",
  "description": "",
  "frontmatter": {
    "outline": false,
    "sidebar": false,
    "aside": false
  },
  "headers": [],
  "relativePath": "zh/resources.md",
  "filePath": "zh/resources.md"
}

Page Frontmatter

{
  "outline": false,
  "sidebar": false,
  "aside": false
}

More

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