Skip to content

Commit 110c869

Browse files
authored
docs(zh): sync update to 35a9c1b (#2084)
1 parent 35a9c1b commit 110c869

35 files changed

+1483
-149
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
4848
text: '更新日志',
4949
link: 'https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md',
5050
},
51+
{
52+
text: 'Vue.js 认证',
53+
link: 'https://certification.vuejs.org/?friend=VUEROUTER',
54+
},
5155
],
5256
},
5357
],
@@ -139,6 +143,10 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
139143
text: '组合式 API',
140144
link: '/zh/guide/advanced/composition-api.html',
141145
},
146+
{
147+
text: 'RouterView 插槽',
148+
link: '/guide/advanced/router-view-slot.html',
149+
},
142150
{
143151
text: '过渡动效',
144152
link: '/zh/guide/advanced/transitions.html',
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"zh": {
3-
"hash": "1a3a28f",
4-
"date": "2023-04-08"
3+
"hash": "35a9c1b",
4+
"date": "2023-12-16"
55
}
6-
}
6+
}

packages/docs/zh/api/index.md

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,43 @@ API 文档
2020
- [RouteLocationNormalizedLoaded](interfaces/RouteLocationNormalizedLoaded.md)
2121
- [RouteLocationOptions](interfaces/RouteLocationOptions.md)
2222
- [RouteMeta](interfaces/RouteMeta.md)
23+
- [RouteRecordMultipleViews](interfaces/RouteRecordMultipleViews.md)
24+
- [RouteRecordMultipleViewsWithChildren](interfaces/RouteRecordMultipleViewsWithChildren.md)
2325
- [RouteRecordNormalized](interfaces/RouteRecordNormalized.md)
26+
- [RouteRecordRedirect](interfaces/RouteRecordRedirect.md)
27+
- [RouteRecordSingleView](interfaces/RouteRecordSingleView.md)
28+
- [RouteRecordSingleViewWithChildren](interfaces/RouteRecordSingleViewWithChildren.md)
2429
- [Router](interfaces/Router.md)
2530
- [RouterHistory](interfaces/RouterHistory.md)
2631
- [RouterLinkProps](interfaces/RouterLinkProps.md)
2732
- [RouterOptions](interfaces/RouterOptions.md)
2833
- [RouterScrollBehavior](interfaces/RouterScrollBehavior.md)
2934
- [RouterViewProps](interfaces/RouterViewProps.md)
35+
- [\_RouteRecordBase](interfaces/RouteRecordBase.md)
3036

3137
## TS 类型别名 %{#Type-Aliases}%
3238

3339
### LocationQuery %{#Type-Aliases-LocationQuery}%
3440

35-
Ƭ **LocationQuery**: `Record`<`string`, `LocationQueryValue` \| `LocationQueryValue`[]\>
41+
Ƭ **LocationQuery**: `Record`\<`string`, `LocationQueryValue` \| `LocationQueryValue`[]\>
3642

3743
出现在 [RouteLocationNormalized](interfaces/RouteLocationNormalized.md) 中的规范化查询对象。
3844

3945
___
4046

4147
### LocationQueryRaw %{#Type-Aliases-LocationQueryRaw}%
4248

43-
Ƭ **LocationQueryRaw**: `Record`<`string` \| `number`, `LocationQueryValueRaw` \| `LocationQueryValueRaw`[]\>
49+
Ƭ **LocationQueryRaw**: `Record`\<`string` \| `number`, `LocationQueryValueRaw` \| `LocationQueryValueRaw`[]\>
4450

4551
松散的 [LocationQuery](index.md#locationquery) 对象,可以被传递给诸如
46-
[push](interfaces/Router.md#push)[replace](interfaces/Router.md#replace) 或任何创建
52+
[Router.push](interfaces/Router.md#push)[Router.replace](interfaces/Router.md#replace) 或任何创建
4753
[RouteLocationRaw](index.md#routelocationraw) 的函数。
4854

4955
___
5056

5157
### PathParserOptions %{#Type-Aliases-PathParserOptions}%
5258

53-
Ƭ **PathParserOptions**: `Pick`<`_PathParserOptions`, ``"end"`` \| ``"sensitive"`` \| ``"strict"``\>
59+
Ƭ **PathParserOptions**: `Pick`\<`_PathParserOptions`, ``"end"`` \| ``"sensitive"`` \| ``"strict"``\>
5460

5561
___
5662

@@ -72,13 +78,13 @@ ___
7278

7379
### RouteParams %{#Type-Aliases-RouteParams}%
7480

75-
Ƭ **RouteParams**: `Record`<`string`, `RouteParamValue` \| `RouteParamValue`[]\>
81+
Ƭ **RouteParams**: `Record`\<`string`, `RouteParamValue` \| `RouteParamValue`[]\>
7682

7783
___
7884

7985
### RouteParamsRaw %{#Type-Aliases-RouteParamsRaw}%
8086

81-
Ƭ **RouteParamsRaw**: `Record`<`string`, `RouteParamValueRaw` \| `Exclude`<`RouteParamValueRaw`, ``null`` \| `undefined`\>[]\>
87+
Ƭ **RouteParamsRaw**: `Record`\<`string`, `RouteParamValueRaw` \| `Exclude`\<`RouteParamValueRaw`, ``null`` \| `undefined`\>[]\>
8288

8389
___
8490

@@ -100,13 +106,13 @@ ___
100106

101107
### RouteRecordRaw %{#Type-Aliases-RouteRecordRaw}%
102108

103-
Ƭ **RouteRecordRaw**: `RouteRecordSingleView` \| `RouteRecordSingleViewWithChildren` \| `RouteRecordMultipleViews` \| `RouteRecordMultipleViewsWithChildren` \| `RouteRecordRedirect`
109+
Ƭ **RouteRecordRaw**: [`RouteRecordSingleView`](interfaces/RouteRecordSingleView.md) \| [`RouteRecordSingleViewWithChildren`](interfaces/RouteRecordSingleViewWithChildren.md) \| [`RouteRecordMultipleViews`](interfaces/RouteRecordMultipleViews.md) \| [`RouteRecordMultipleViewsWithChildren`](interfaces/RouteRecordMultipleViewsWithChildren.md) \| [`RouteRecordRedirect`](interfaces/RouteRecordRedirect.md)
104110

105111
___
106112

107113
### UseLinkOptions %{#Type-Aliases-UseLinkOptions}%
108114

109-
Ƭ **UseLinkOptions**: `VueUseOptions`<`RouterLinkOptions`\>
115+
Ƭ **UseLinkOptions**: `VueUseOptions`\<`RouterLinkOptions`\>
110116

111117
## 变量 %{#Variables}%
112118

@@ -120,14 +126,24 @@ ___
120126

121127
### RouterView %{#Variables-RouterView}%
122128

123-
`Const` **RouterView**: () => { `$props`: `AllowedComponentProps` & `ComponentCustomProps` & `VNodeProps` & [`RouterViewProps`](interfaces/RouterViewProps.md) ; `$slots`: { `default?`: (`__namedParameters`: { `Component`: `VNode`<`RendererNode`, `RendererElement`, { `[key: string]`: `any`; }\> ; `route`: [`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md) }) => `VNode`<`RendererNode`, `RendererElement`, { `[key: string]`: `any`; }\>[] } }
129+
`Const` **RouterView**: () => \{ `$props`: `AllowedComponentProps` & `ComponentCustomProps` & `VNodeProps` & [`RouterViewProps`](interfaces/RouterViewProps.md) ; `$slots`: \{ `default?`: (`__namedParameters`: \{ `Component`: `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\> ; `route`: [`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md) }) => `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\>[] } }
124130

125131
#### 类型声明 %{#Variables-RouterView-Type-declaration}%
126132

127-
**new RouterView**()
133+
**new RouterView**(): `Object`
128134

129135
用于显示用户当前所处路由的组件。
130136

137+
##### 返回值 %{#Variables-RouterView-Returns}%
138+
139+
`Object`
140+
141+
| 名称 | 类型 |
142+
| :------ | :------ |
143+
| `$props` | `AllowedComponentProps` & `ComponentCustomProps` & `VNodeProps` & [`RouterViewProps`](interfaces/RouterViewProps.md) |
144+
| `$slots` | \{ `default?`: (`__namedParameters`: \{ `Component`: `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\> ; `route`: [`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md) }) => `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\>[] } |
145+
| `$slots.default?` | (`__namedParameters`: \{ `Component`: `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\> ; `route`: [`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md) }) => `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\>[] |
146+
131147
___
132148

133149
### START\_LOCATION %{#Variables-START_LOCATION}%
@@ -194,6 +210,16 @@ ___
194210

195211
创建一个 hash 模式的历史。在没有主机的 web 应用 (如 `file://`) 或无法通过配置服务器来处理任意 URL 的时候非常有用。
196212

213+
#### 参数 %{#Functions-createWebHashHistory-Parameters}%
214+
215+
| 名称 | 类型 | 描述 |
216+
| :------ | :------ | :------ |
217+
| `base?` | `string` | 可选提供的基础位置。默认为 `location.pathname + location.search`。如果在 `head` 中有一个 `<base>` 标签,它的值会因此被忽略,**但注意它会影响所有 history.pushState() 的调用**,这意味着如果你使用一个 `<base>` 标签,它的 `href`**必须与这个参数匹配** (忽略 `#` 后的任何东西)。 |
218+
219+
#### 返回值 %{#Functions-createWebHashHistory-Returns}%
220+
221+
[`RouterHistory`](interfaces/RouterHistory.md)
222+
197223
**示例**
198224

199225
```js
@@ -210,16 +236,6 @@ createWebHashHistory('/other-folder/') // 给出一个 `https://example.com/othe
210236
createWebHashHistory('/iAmIgnored') // 给出一个 `file:///usr/etc/folder/index.html#` 的 URL
211237
```
212238

213-
#### 参数 %{#Functions-createWebHashHistory-Parameters}%
214-
215-
| 名称 | 类型 | 描述 |
216-
| :------ | :------ | :------ |
217-
| `base?` | `string` | 可选提供的基础位置。默认为 `location.pathname + location.search`。如果在 `head` 中有一个 `<base>` 标签,它的值会因此被忽略,**但注意它会影响所有 history.pushState() 的调用**,这意味着如果你使用一个 `<base>` 标签,它的 `href`**必须与这个参数匹配** (忽略 `#` 后的任何东西)。 |
218-
219-
#### 返回值 %{#Functions-createWebHashHistory-Returns}%
220-
221-
[`RouterHistory`](interfaces/RouterHistory.md)
222-
223239
___
224240

225241
### createWebHistory %{#Functions-createWebHistory}%
@@ -246,6 +262,17 @@ ___
246262

247263
检查一个对象是否是 [NavigationFailure](interfaces/NavigationFailure.md)
248264

265+
#### 参数 %{#Functions-isNavigationFailure-Parameters}%
266+
267+
| 名称 | 类型 | 描述 |
268+
| :------ | :------ | :------ |
269+
| `error` | `any` | 可能的 [NavigationFailure](interfaces/NavigationFailure.md) |
270+
| `type?` | `NAVIGATION_GUARD_REDIRECT` | 可选的待检查类型 |
271+
272+
#### 返回值 %{#Functions-isNavigationFailure-Returns}%
273+
274+
error is NavigationRedirectError
275+
249276
**示例**
250277

251278
```js
@@ -267,17 +294,6 @@ router.afterEach((to, from, failure) => {
267294
})
268295
```
269296

270-
#### 参数 %{#Functions-isNavigationFailure-Parameters}%
271-
272-
| 名称 | 类型 | 描述 |
273-
| :------ | :------ | :------ |
274-
| `error` | `any` | 可能的 [NavigationFailure](interfaces/NavigationFailure.md) |
275-
| `type?` | `NAVIGATION_GUARD_REDIRECT` | 可选的待检查类型 |
276-
277-
#### 返回值 %{#Functions-isNavigationFailure-Returns}%
278-
279-
error is NavigationRedirectError
280-
281297
**isNavigationFailure**(`error`, `type?`): error is NavigationFailure
282298

283299
#### 参数 %{#Functions-isNavigationFailure-Parameters_1}%
@@ -295,7 +311,7 @@ ___
295311

296312
### loadRouteLocation %{#Functions-loadRouteLocation}%
297313

298-
**loadRouteLocation**(`route`): `Promise`<[`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md)\>
314+
**loadRouteLocation**(`route`): `Promise`\<[`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md)\>
299315

300316
确保路由被加载,所以它可以作为一个 prop 传递给 `<RouterView>`
301317

@@ -307,7 +323,7 @@ ___
307323

308324
#### 返回值 %{#Functions-loadRouteLocation-Returns}%
309325

310-
`Promise`<[`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md)\>
326+
`Promise`\<[`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md)\>
311327

312328
___
313329

@@ -355,7 +371,7 @@ ___
355371

356372
| 名称 | 类型 |
357373
| :------ | :------ |
358-
| `props` | `VueUseOptions`<`RouterLinkOptions`\> |
374+
| `props` | `VueUseOptions`\<`RouterLinkOptions`\> |
359375

360376
#### 返回值 %{#Functions-useLink-Returns}%
361377

@@ -364,10 +380,10 @@ ___
364380
| 名称 | 类型 |
365381
| :------ | :------ |
366382
| `href` | `ComputedRef<string\>` |
367-
| `isActive` | `ComputedRef`<`boolean`\> |
368-
| `isExactActive` | `ComputedRef`<`boolean`\> |
369-
| `navigate` | (`e`: `MouseEvent`) => `Promise`<`void` \| [`NavigationFailure`](interfaces/NavigationFailure.md)\> |
370-
| `route` | `ComputedRef`<[`RouteLocation`](interfaces/RouteLocation.md) & { `href`: `string` }\> |
383+
| `isActive` | `ComputedRef`\<`boolean`\> |
384+
| `isExactActive` | `ComputedRef`\<`boolean`\> |
385+
| `navigate` | (`e`: `MouseEvent`) => `Promise`\<`void` \| [`NavigationFailure`](interfaces/NavigationFailure.md)\> |
386+
| `route` | `ComputedRef`\<[`RouteLocation`](interfaces/RouteLocation.md) & { `href`: `string` }\> |
371387

372388
___
373389

packages/docs/zh/api/interfaces/NavigationGuard.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ editLink: false
66

77
# 接口:NavigationGuard %{#interface-navigationguard}%
88

9+
导航守卫。详情可查阅[导航守卫](/zh/guide/advanced/navigation-guards.md)
10+
911
## 可调用函数 %{#Callable}%
1012

1113
### NavigationGuard %{#Callable-NavigationGuard}%
1214

13-
**NavigationGuard**(`to`, `from`, `next`): `NavigationGuardReturn` \| `Promise`<`NavigationGuardReturn`\>
14-
15-
导航守卫。详情可查阅[导航守卫](/zh/guide/advanced/navigation-guards.md).
15+
**NavigationGuard**(`to`, `from`, `next`): `NavigationGuardReturn` \| `Promise`\<`NavigationGuardReturn`\>
1616

1717
#### 参数 %{#Callable-NavigationGuard-Parameters}%
1818

@@ -24,4 +24,4 @@ editLink: false
2424

2525
#### 返回值 %{#Callable-NavigationGuard-Returns}%
2626

27-
`NavigationGuardReturn` \| `Promise`<`NavigationGuardReturn`\>
27+
`NavigationGuardReturn` \| `Promise`\<`NavigationGuardReturn`\>

packages/docs/zh/api/interfaces/NavigationGuardWithThis.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ editLink: false
44

55
[API 参考](../index.md) / NavigationGuardWithThis
66

7-
# 接口:NavigationGuardWithThis<T\> %{#interface-navigationguardwiththis-t}%
7+
# 接口:NavigationGuardWithThis\<T\> %{#interface-navigationguardwiththis-t}%
8+
9+
导航守卫。详情可查阅[导航守卫](/zh/guide/advanced/navigation-guards.md)
810

911
## 类型参数 %{#Type-parameters}%
1012

@@ -16,9 +18,7 @@ editLink: false
1618

1719
### NavigationGuardWithThis %{#Callable-NavigationGuardWithThis}%
1820

19-
**NavigationGuardWithThis**(`this`, `to`, `from`, `next`): `NavigationGuardReturn` \| `Promise`<`NavigationGuardReturn`\>
20-
21-
导航守卫。详情可查阅[导航守卫](/zh/guide/advanced/navigation-guards.md).
21+
**NavigationGuardWithThis**(`this`, `to`, `from`, `next`): `NavigationGuardReturn` \| `Promise`\<`NavigationGuardReturn`\>
2222

2323
#### 参数 %{#Callable-NavigationGuardWithThis-Parameters}%
2424

@@ -31,4 +31,4 @@ editLink: false
3131

3232
#### 返回值 %{#Callable-NavigationGuardWithThis-Returns}%
3333

34-
`NavigationGuardReturn` \| `Promise`<`NavigationGuardReturn`\>
34+
`NavigationGuardReturn` \| `Promise`\<`NavigationGuardReturn`\>

packages/docs/zh/api/interfaces/RouteLocationMatched.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ___
3030

3131
### beforeEnter %{#Properties-beforeEnter}%
3232

33-
**beforeEnter**: `undefined` \| [`NavigationGuardWithThis`](NavigationGuardWithThis.md)<`undefined`\> \| [`NavigationGuardWithThis`](NavigationGuardWithThis.md)<`undefined`\>[]
33+
**beforeEnter**: `undefined` \| [`NavigationGuardWithThis`](NavigationGuardWithThis.md)\<`undefined`\> \| [`NavigationGuardWithThis`](NavigationGuardWithThis.md)\<`undefined`\>[]
3434

3535
被注册的 beforeEnter 守卫
3636

@@ -54,7 +54,7 @@ ___
5454

5555
### components %{#Properties-components}%
5656

57-
**components**: `undefined` \| ``null`` \| `Record`<`string`, [`RouteComponent`](../index.md#routecomponent)\>
57+
**components**: `undefined` \| ``null`` \| `Record`\<`string`, [`RouteComponent`](../index.md#routecomponent)\>
5858

5959
{@inheritDoc RouteRecordMultipleViews.components}
6060

@@ -66,7 +66,7 @@ ___
6666

6767
### instances %{#Properties-instances}%
6868

69-
**instances**: `Record`<`string`, `undefined` \| ``null`` \| `ComponentPublicInstance`<{}, {}, {}, {}, {}, {}, {}, {}, ``false``, `ComponentOptionsBase`<`any`, `any`, `any`, `any`, `any`, `any`, `any`, `any`, `any`, {}, {}, `string`\>, {}\>\>
69+
**instances**: `Record`\<`string`, `undefined` \| ``null`` \| `ComponentPublicInstance`\>
7070

7171
<!-- TODO: translation -->
7272

@@ -82,7 +82,9 @@ ___
8282

8383
**meta**: [`RouteMeta`](RouteMeta.md)
8484

85-
{@inheritDoc _RouteRecordBase.meta}
85+
<!-- TODO: translation -->
86+
87+
Arbitrary data attached to the record.
8688

8789
#### 继承自 %{#Properties-meta-Inherited-from}%
8890

@@ -94,7 +96,9 @@ ___
9496

9597
**name**: `undefined` \| [`RouteRecordName`](../index.md#routerecordname)
9698

97-
{@inheritDoc _RouteRecordBase.name}
99+
<!-- TODO: translation -->
100+
101+
Name for the route record. Must be unique.
98102

99103
#### 继承自 %{#Properties-name-Inherited-from}%
100104

@@ -106,7 +110,9 @@ ___
106110

107111
**path**: `string`
108112

109-
{@inheritDoc _RouteRecordBase.path}
113+
<!-- TODO: translation -->
114+
115+
Path of the record. Should start with `/` unless the record is the child of another record.
110116

111117
#### 继承自 %{#Properties-path-Inherited-from}%
112118

@@ -116,9 +122,11 @@ ___
116122

117123
### props %{#Properties-props}%
118124

119-
**props**: `Record`<`string`, `_RouteRecordProps`\>
125+
**props**: `Record`\<`string`, `_RouteRecordProps`\>
126+
127+
<!-- TODO: translation -->
120128

121-
{@inheritDoc RouteRecordMultipleViews.props}
129+
Allow passing down params as props to the component rendered by `router-view`. Should be an object with the same keys as `components` or a boolean to be applied to every component.
122130

123131
#### 继承自 %{#Properties-props-Inherited-from}%
124132

@@ -130,7 +138,9 @@ ___
130138

131139
**redirect**: `undefined` \| `RouteRecordRedirectOption`
132140

133-
{@inheritDoc _RouteRecordBase.redirect}
141+
<!-- TODO: translation -->
142+
143+
Where to redirect if the route is directly matched. The redirection happens before any navigation guard and triggers a new navigation with the new target location.
134144

135145
#### 继承自 %{#Properties-redirect-Inherited-from}%
136146

packages/docs/zh/api/interfaces/RouteLocationNormalized.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ editLink: false
66

77
# 接口:RouteLocationNormalized
88

9-
[RouteLocation](RouteLocation.md) 类似但是其 [matched](RouteLocationNormalized.md#matched) 无法包含重定向的记录
9+
[RouteLocation](RouteLocation.md) 类似但是其 [RouteLocationNormalized.matched](RouteLocationNormalized.md#matched) 无法包含重定向的记录
1010

1111
## 继承关系 %{#Hierarchy}%
1212

0 commit comments

Comments
 (0)