Skip to content

Commit

Permalink
docs: add global-computed
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Oct 15, 2018
1 parent e99eb95 commit eaaa25c
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 0 deletions.
83 changes: 83 additions & 0 deletions packages/docs/docs/miscellaneous/global-computed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
sidebar: auto
---

# Global Computed

In VuePress, some core [computed](https://vuejs.org/v2/guide/computed.html#Computed-Properties) properties are built in for use by [default theme](../theme/default-theme-config.md) or custom themes.

## $site

This is the `$site` value of the website you see now:

``` json
{
"title": "VuePress",
"description": "Vue 驱动的静态网站生成器",
"base": "/",
"pages": [
{
"lastUpdated": 1524027677000,
"path": "/",
"title": "VuePress",
"frontmatter": {}
},
...
]
}
```

## $page

This is the `$page` value of the page you see now:

``` json
{
"title": "Global Computed",
"frontmatter": {},
"regularPath": "/miscellaneous/global-computed.html",
"key": "v-d4cbeb69eff3d",
"path": "/miscellaneous/global-computed.html",
"headers": [
{
"level": 2,
"title": "$site",
"slug": "site"
},
{
"level": 2,
"title": "$page",
"slug": "$page"
},
...
]
}
```

## $lang

The language of the current page. default value is `en-US`.

**Also see:**

- [Internationalization](../guide/i18n.md)

## $localePath

The locale path prefix for the current page, the default value is `/`.

**Also see:**

- [Internationalization](../guide/i18n.md)

## $title

Value of the `<title>` label used for the current page.

## $description

The `content` value of the `<meta name= "description" content= "...">` for the current page.

## $themeConfig

i.e. `siteConfig.themeConfig`
85 changes: 85 additions & 0 deletions packages/docs/docs/zh/miscellaneous/global-computed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
sidebar: auto
---

# 全局计算属性

在 VuePress 中,内置了一些核心的[计算属性](https://cn.vuejs.org/v2/guide/computed.html#%E8%AE%A1%E7%AE%97%E5%B1%9E%E6%80%A7),以供[默认主题](../theme/default-theme-config.md) 或自定义主题使用。

## $site

这是你现在看到的这个网站的 `$site` 的值:

``` json
{
"title": "VuePress",
"description": "Vue 驱动的静态网站生成器",
"base": "/",
"pages": [
{
"lastUpdated": 1524027677000,
"path": "/",
"title": "VuePress",
"frontmatter": {}
},
...
]
}
```

## $page

这是你现在看到的这个页面的 `$page` 的值:

``` json
{
"title": "Global Computed",
"frontmatter": {
"sidebar": "auto"
},
"regularPath": "/zh/miscellaneous/global-computed.html",
"key": "v-bc9a3e3f9692d",
"path": "/zh/miscellaneous/global-computed.html",
"headers": [
{
"level": 2,
"title": "$site",
"slug": "site"
},
{
"level": 2,
"title": "$page",
"slug": "page"
},
...
]
}
```

## $lang

当前页面的语言,默认值为 `en-US`

**参考:**

- [多语言支持](../guide/i18n.md)

## $localePath

当前页面的 locale 路径前缀,默认值为 `/`,当前页面为 `/zh/`

**参考:**

- [多语言支持](../guide/i18n.md)

## $title

用于当前页面的 `<title>` 标签的值。

## $description

用于当前页面的 `<meta name="description" content="...">``content` 值。

## $themeConfig

`siteConfig.themeConfig`

0 comments on commit eaaa25c

Please sign in to comment.