Skip to content

Commit eaaa25c

Browse files
committed
docs: add global-computed
1 parent e99eb95 commit eaaa25c

File tree

2 files changed

+168
-0
lines changed

2 files changed

+168
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
sidebar: auto
3+
---
4+
5+
# Global Computed
6+
7+
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.
8+
9+
## $site
10+
11+
This is the `$site` value of the website you see now:
12+
13+
``` json
14+
{
15+
"title": "VuePress",
16+
"description": "Vue 驱动的静态网站生成器",
17+
"base": "/",
18+
"pages": [
19+
{
20+
"lastUpdated": 1524027677000,
21+
"path": "/",
22+
"title": "VuePress",
23+
"frontmatter": {}
24+
},
25+
...
26+
]
27+
}
28+
```
29+
30+
## $page
31+
32+
This is the `$page` value of the page you see now:
33+
34+
``` json
35+
{
36+
"title": "Global Computed",
37+
"frontmatter": {},
38+
"regularPath": "/miscellaneous/global-computed.html",
39+
"key": "v-d4cbeb69eff3d",
40+
"path": "/miscellaneous/global-computed.html",
41+
"headers": [
42+
{
43+
"level": 2,
44+
"title": "$site",
45+
"slug": "site"
46+
},
47+
{
48+
"level": 2,
49+
"title": "$page",
50+
"slug": "$page"
51+
},
52+
...
53+
]
54+
}
55+
```
56+
57+
## $lang
58+
59+
The language of the current page. default value is `en-US`.
60+
61+
**Also see:**
62+
63+
- [Internationalization](../guide/i18n.md)
64+
65+
## $localePath
66+
67+
The locale path prefix for the current page, the default value is `/`.
68+
69+
**Also see:**
70+
71+
- [Internationalization](../guide/i18n.md)
72+
73+
## $title
74+
75+
Value of the `<title>` label used for the current page.
76+
77+
## $description
78+
79+
The `content` value of the `<meta name= "description" content= "...">` for the current page.
80+
81+
## $themeConfig
82+
83+
i.e. `siteConfig.themeConfig`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
sidebar: auto
3+
---
4+
5+
# 全局计算属性
6+
7+
在 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) 或自定义主题使用。
8+
9+
## $site
10+
11+
这是你现在看到的这个网站的 `$site` 的值:
12+
13+
``` json
14+
{
15+
"title": "VuePress",
16+
"description": "Vue 驱动的静态网站生成器",
17+
"base": "/",
18+
"pages": [
19+
{
20+
"lastUpdated": 1524027677000,
21+
"path": "/",
22+
"title": "VuePress",
23+
"frontmatter": {}
24+
},
25+
...
26+
]
27+
}
28+
```
29+
30+
## $page
31+
32+
这是你现在看到的这个页面的 `$page` 的值:
33+
34+
``` json
35+
{
36+
"title": "Global Computed",
37+
"frontmatter": {
38+
"sidebar": "auto"
39+
},
40+
"regularPath": "/zh/miscellaneous/global-computed.html",
41+
"key": "v-bc9a3e3f9692d",
42+
"path": "/zh/miscellaneous/global-computed.html",
43+
"headers": [
44+
{
45+
"level": 2,
46+
"title": "$site",
47+
"slug": "site"
48+
},
49+
{
50+
"level": 2,
51+
"title": "$page",
52+
"slug": "page"
53+
},
54+
...
55+
]
56+
}
57+
```
58+
59+
## $lang
60+
61+
当前页面的语言,默认值为 `en-US`
62+
63+
**参考:**
64+
65+
- [多语言支持](../guide/i18n.md)
66+
67+
## $localePath
68+
69+
当前页面的 locale 路径前缀,默认值为 `/`,当前页面为 `/zh/`
70+
71+
**参考:**
72+
73+
- [多语言支持](../guide/i18n.md)
74+
75+
## $title
76+
77+
用于当前页面的 `<title>` 标签的值。
78+
79+
## $description
80+
81+
用于当前页面的 `<meta name="description" content="...">``content` 值。
82+
83+
## $themeConfig
84+
85+
`siteConfig.themeConfig`

0 commit comments

Comments
 (0)