Skip to content

Commit c3d3bc0

Browse files
committed
docs: add chinese docs
1 parent 58d89c1 commit c3d3bc0

30 files changed

+4027
-95
lines changed

packages/docs/.vitepress/config/en.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
22

3-
export const META_URL = 'https://pinia.vuejs.org'
4-
export const META_TITLE = 'Pinia 🍍'
5-
export const META_DESCRIPTION =
6-
'Intuitive, type safe, light and flexible Store for Vue'
3+
export const META_URL = 'https://router.vuejs.org'
4+
export const META_TITLE = 'Vue Router'
5+
export const META_DESCRIPTION = 'The official Router for Vue.js'
76

87
export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
98
description: META_DESCRIPTION,
@@ -17,7 +16,7 @@ export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
1716

1817
themeConfig: {
1918
editLink: {
20-
pattern: 'https://github.com/vuejs/pinia/edit/v2/packages/docs/:path',
19+
pattern: 'https://github.com/vuejs/router/edit/v2/packages/docs/:path',
2120
text: 'Suggest changes to this page',
2221
},
2322

@@ -171,19 +170,12 @@ export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
171170
},
172171
],
173172

174-
// '/api/': [
175-
// {
176-
// text: 'packages',
177-
// items: [
178-
// { text: 'pinia', link: '/api/modules/pinia.html' },
179-
// { text: '@pinia/nuxt', link: '/api/modules/pinia_nuxt.html' },
180-
// {
181-
// text: '@pinia/testing',
182-
// link: '/api/modules/pinia_testing.html',
183-
// },
184-
// ],
185-
// },
186-
// ],
173+
'/api/': [
174+
{
175+
text: 'packages',
176+
items: [{ text: 'vue-router', link: '/api/' }],
177+
},
178+
],
187179
},
188180
},
189181
}

packages/docs/.vitepress/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ export default defineConfig({
88

99
locales: {
1010
root: { label: 'English', lang: 'en-US', link: '/', ...enConfig },
11-
// zh: { label: '简体中文', lang: 'zh-CN', link: '/zh/', ...zhConfig },
11+
zh: { label: '简体中文', lang: 'zh-CN', link: '/zh/', ...zhConfig },
1212
},
1313
})

packages/docs/.vitepress/config/shared.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { defineConfig, HeadConfig } from 'vitepress'
22

3-
export const META_IMAGE = 'https://pinia.vuejs.org/social.png'
3+
// TODO:
4+
// export const META_IMAGE = 'https://router.vuejs.org/social.png'
5+
export const META_IMAGE = null
46
export const isProduction =
57
process.env.NETLIFY && process.env.CONTEXT === 'production'
68

@@ -59,13 +61,13 @@ export const sharedConfig = defineConfig({
5961
content: 'summary_large_image',
6062
},
6163
],
62-
[
63-
'meta',
64-
{
65-
property: 'twitter:image',
66-
content: META_IMAGE,
67-
},
68-
],
64+
// [
65+
// 'meta',
66+
// {
67+
// property: 'twitter:image',
68+
// content: META_IMAGE,
69+
// },
70+
// ],
6971

7072
[
7173
'script',

packages/docs/.vitepress/config/zh.ts

Lines changed: 95 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
22

3-
export const META_URL = 'https://pinia.vuejs.org'
4-
export const META_TITLE = 'Pinia 🍍'
5-
export const META_DESCRIPTION = '值得你喜欢的 Vue Store'
6-
// TODO: translation of this
7-
// 'Intuitive, type safe, light and flexible Store for Vue'
3+
export const META_URL = 'https://router.vuejs.org'
4+
export const META_TITLE = 'Vue Router'
5+
export const META_DESCRIPTION = 'Vue.js 的官方路由'
86

97
export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
108
description: META_DESCRIPTION,
@@ -18,127 +16,160 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
1816

1917
themeConfig: {
2018
editLink: {
21-
pattern: 'https://github.com/vuejs/pinia/edit/v2/packages/docs/:path',
19+
pattern: 'https://github.com/vuejs/router/edit/v2/packages/docs/:path',
2220
text: '对本页提出修改建议',
2321
},
2422

2523
outlineTitle: '本页内容',
2624

2725
nav: [
28-
// { text: 'Config', link: '/config/' },
29-
// { text: 'Plugins', link: '/plugins/' },
3026
{
31-
text: '指南',
32-
link: '/zh/core-concepts/',
33-
activeMatch: '^/zh/core-concepts/',
27+
text: '教程',
28+
link: '/zh/guide/',
29+
activeMatch: '^/zh/guide/',
30+
},
31+
{
32+
text: 'API 参考',
33+
link: '/zh/api/',
34+
activeMatch: '^/zh/api/',
35+
},
36+
{
37+
text: 'v4.x',
38+
items: [{ text: 'v3.x', link: 'https://v3.router.vuejs.org/zh' }],
3439
},
35-
{ text: 'API', link: '/zh/api/', activeMatch: '^/zh/api/' },
36-
{ text: '手册', link: '/zh/cookbook/', activeMatch: '^/zh/cookbook/' },
3740
{
3841
text: '相关链接',
3942
items: [
4043
{
41-
text: '论坛',
42-
link: 'https://github.com/vuejs/pinia/discussions',
44+
text: 'Discussions',
45+
link: 'https://github.com/vuejs/router/discussions',
4346
},
4447
{
4548
text: '更新日志',
46-
link: 'https://github.com/vuejs/pinia/blob/v2/packages/pinia/CHANGELOG.md',
49+
link: 'https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md',
4750
},
4851
],
4952
},
5053
],
54+
5155
sidebar: {
5256
'/zh/api/': [
5357
{
5458
text: 'packages',
55-
items: [
56-
{ text: 'pinia', link: '/zh/api/modules/pinia.html' },
57-
{ text: '@pinia/nuxt', link: '/zh/api/modules/pinia_nuxt.html' },
58-
{
59-
text: '@pinia/testing',
60-
link: '/zh/api/modules/pinia_testing.html',
61-
},
62-
],
59+
items: [{ text: 'vue-router', link: '/api/' }],
6360
},
6461
],
62+
6563
'/zh/': [
6664
{
67-
text: '介绍',
6865
items: [
6966
{
70-
text: 'Pinia 是什么?',
67+
text: '介绍',
7168
link: '/zh/introduction.html',
7269
},
7370
{
74-
text: '开始',
75-
link: '/zh/getting-started.html',
71+
text: '安装',
72+
link: '/zh/installation.html',
7673
},
7774
],
7875
},
7976
{
80-
text: '核心概念',
77+
text: '基础',
78+
collapsible: false,
8179
items: [
82-
{ text: '定义 Store', link: '/zh/core-concepts/' },
83-
{ text: 'State', link: '/zh/core-concepts/state.html' },
84-
{ text: 'Getter', link: '/zh/core-concepts/getters.html' },
85-
{ text: 'Action', link: '/zh/core-concepts/actions.html' },
86-
{ text: '插件', link: '/zh/core-concepts/plugins.html' },
8780
{
88-
text: '组件外的 Store',
89-
link: '/zh/core-concepts/outside-component-usage.html',
81+
text: '入门',
82+
link: '/zh/guide/',
83+
},
84+
{
85+
text: '动态路由匹配',
86+
link: '/zh/guide/essentials/dynamic-matching.html',
87+
},
88+
{
89+
text: '路由的匹配语法',
90+
link: '/zh/guide/essentials/route-matching-syntax.html',
91+
},
92+
{
93+
text: '嵌套路由',
94+
link: '/zh/guide/essentials/nested-routes.html',
95+
},
96+
{
97+
text: '编程式导航',
98+
link: '/zh/guide/essentials/navigation.html',
99+
},
100+
{
101+
text: '命名路由',
102+
link: '/zh/guide/essentials/named-routes.html',
90103
},
91-
],
92-
},
93-
{
94-
text: '服务端渲染 (SSR)',
95-
items: [
96104
{
97-
text: 'Vue 与 Vite',
98-
link: '/zh/ssr/',
105+
text: '命名视图',
106+
link: '/zh/guide/essentials/named-views.html',
99107
},
100108
{
101-
text: 'Nuxt.js',
102-
link: '/zh/ssr/nuxt.html',
109+
text: '重定向和别名',
110+
link: '/zh/guide/essentials/redirect-and-alias.html',
111+
},
112+
{
113+
text: '路由组件传参',
114+
link: '/zh/guide/essentials/passing-props.html',
115+
},
116+
{
117+
text: '不同的历史记录模式',
118+
link: '/zh/guide/essentials/history-mode.html',
103119
},
104120
],
105121
},
106122
{
107-
text: '手册',
108-
collapsible: true,
109-
collapsed: false,
123+
text: '进阶',
124+
collapsible: false,
110125
items: [
111126
{
112-
text: '目录',
113-
link: '/zh/cookbook/',
127+
text: '导航守卫',
128+
link: '/zh/guide/advanced/navigation-guards.html',
114129
},
115130
{
116-
text: '从 Vuex ≤4 迁移',
117-
link: '/zh/cookbook/migration-vuex.html',
131+
text: '路由元信息',
132+
link: '/zh/guide/advanced/meta.html',
118133
},
119134
{
120-
text: '热更新',
121-
link: '/zh/cookbook/hot-module-replacement.html',
135+
text: '数据获取',
136+
link: '/zh/guide/advanced/data-fetching.html',
122137
},
123138
{
124-
text: '测试',
125-
link: '/zh/cookbook/testing.html',
139+
text: '组合式 API',
140+
link: '/zh/guide/advanced/composition-api.html',
126141
},
127142
{
128-
text: '不使用 setup() 的用法',
129-
link: '/zh/cookbook/options-api.html',
143+
text: '过渡动效',
144+
link: '/zh/guide/advanced/transitions.html',
130145
},
131146
{
132-
text: '组合式 Stores',
133-
link: '/zh/cookbook/composing-stores.html',
147+
text: '滚动行为',
148+
link: '/zh/guide/advanced/scroll-behavior.html',
134149
},
135150
{
136-
text: '从 v0/v1 迁移至 v2',
137-
link: '/zh/cookbook/migration-v1-v2.html',
151+
text: '路由懒加载',
152+
link: '/zh/guide/advanced/lazy-loading.html',
138153
},
139154
{
140-
text: '处理组合式函数',
141-
link: '/zh/cookbook/composables.html',
155+
text: '扩展 RouterLink',
156+
link: '/zh/guide/advanced/extending-router-link.html',
157+
},
158+
{
159+
text: '导航故障',
160+
link: '/zh/guide/advanced/navigation-failures.html',
161+
},
162+
{
163+
text: '动态路由',
164+
link: '/zh/guide/advanced/dynamic-routing.html',
165+
},
166+
],
167+
},
168+
{
169+
items: [
170+
{
171+
text: '从 Vue2 迁移',
172+
link: '/zh/guide/migration/index.html',
142173
},
143174
],
144175
},

packages/docs/.vitepress/theme/styles/sponsors.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
border-radius: 2em;
99
transition: all 0.15s ease;
1010
box-sizing: border-box;
11-
border: 2px solid var(--c-yellow-dark);
11+
border: 2px solid var(--vp-c-brand-dark);
1212
}
1313

1414
.become-sponsor:hover {
15-
background-color: var(--c-yellow);
15+
background-color: var(--vp-c-brand);
1616
text-decoration: none;
17-
border-color: var(--c-yellow);
18-
color: var(--c-text-light-1);
17+
border-color: var(--vp-c-brand);
18+
color: var(--vp-button-brand-text);
1919
}
2020

2121
.sponsors-top .become-sponsor {

0 commit comments

Comments
 (0)