From: Jinjiang Date: Tue, 16 May 2023 01:46:37 +0000 (+1000) Subject: docs(zh): translate api interfaces (#1821) X-Git-Tag: v4.2.1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ea7052a0906b1161fc3594d088135005d7efd4f;p=thirdparty%2Fvuejs%2Frouter.git docs(zh): translate api interfaces (#1821) * docs(zh): translate api interfaces * Update Router.md * Apply suggestions from code review Co-authored-by: wxsm --------- Co-authored-by: wxsm --- diff --git a/packages/docs/zh/api/enums/NavigationFailureType.md b/packages/docs/zh/api/enums/NavigationFailureType.md index 16e66b20..0f21352a 100644 --- a/packages/docs/zh/api/enums/NavigationFailureType.md +++ b/packages/docs/zh/api/enums/NavigationFailureType.md @@ -2,7 +2,7 @@ editLink: false --- -[API Documentation](../index.md) / NavigationFailureType +[API 参考](../index.md) / NavigationFailureType # 枚举:NavigationFailureType %{#enumeration-navigationfailuretype}% diff --git a/packages/docs/zh/api/interfaces/HistoryState.md b/packages/docs/zh/api/interfaces/HistoryState.md index f4becd06..2e1cc91e 100644 --- a/packages/docs/zh/api/interfaces/HistoryState.md +++ b/packages/docs/zh/api/interfaces/HistoryState.md @@ -2,7 +2,7 @@ editLink: false --- -[API Documentation](../index.md) / HistoryState +[API 参考](../index.md) / HistoryState # 接口:HistoryState %{#interface-historystate}% diff --git a/packages/docs/zh/api/interfaces/NavigationFailure.md b/packages/docs/zh/api/interfaces/NavigationFailure.md index d1c5f4c6..173bb281 100644 --- a/packages/docs/zh/api/interfaces/NavigationFailure.md +++ b/packages/docs/zh/api/interfaces/NavigationFailure.md @@ -2,7 +2,7 @@ editLink: false --- -[API Documentation](../index.md) / NavigationFailure +[API 参考](../index.md) / NavigationFailure # 接口:NavigationFailure %{#interface-navigationfailure}% @@ -68,7 +68,7 @@ ___ • **to**: [`RouteLocationNormalized`](RouteLocationNormalized.md) -Route location we were navigating to +要导航至的下一个路由位置 ___ @@ -76,4 +76,4 @@ ___ • **type**: `NAVIGATION_ABORTED` \| `NAVIGATION_CANCELLED` \| `NAVIGATION_DUPLICATED` -Type of the navigation. One of [NavigationFailureType](../enums/NavigationFailureType.md) +导航类型。属于 [NavigationFailureType](../enums/NavigationFailureType.md) 的一种。 diff --git a/packages/docs/zh/api/interfaces/NavigationGuard.md b/packages/docs/zh/api/interfaces/NavigationGuard.md index 59f65bb1..10c1d0ae 100644 --- a/packages/docs/zh/api/interfaces/NavigationGuard.md +++ b/packages/docs/zh/api/interfaces/NavigationGuard.md @@ -2,27 +2,26 @@ editLink: false --- -[API Documentation](../index.md) / NavigationGuard +[API 参考](../index.md) / NavigationGuard -# Interface: NavigationGuard +# 接口:NavigationGuard %{#interface-navigationguard}% -## Callable %{#Callable}% +## 可调用函数 %{#Callable}% ### NavigationGuard %{#Callable-NavigationGuard}% ▸ **NavigationGuard**(`to`, `from`, `next`): `NavigationGuardReturn` \| `Promise`<`NavigationGuardReturn`\> -Navigation guard. See [Navigation -Guards](/guide/advanced/navigation-guards.md). +导航守卫。详情可查阅[导航守卫](/zh/guide/advanced/navigation-guards.md). -#### Parameters %{#Callable-NavigationGuard-Parameters}% +#### 参数 %{#Callable-NavigationGuard-Parameters}% -| Name | Type | +| 名称 | 类型 | | :------ | :------ | | `to` | [`RouteLocationNormalized`](RouteLocationNormalized.md) | | `from` | [`RouteLocationNormalized`](RouteLocationNormalized.md) | | `next` | [`NavigationGuardNext`](NavigationGuardNext.md) | -#### Returns %{#Callable-NavigationGuard-Returns}% +#### 返回值 %{#Callable-NavigationGuard-Returns}% `NavigationGuardReturn` \| `Promise`<`NavigationGuardReturn`\> diff --git a/packages/docs/zh/api/interfaces/NavigationGuardNext.md b/packages/docs/zh/api/interfaces/NavigationGuardNext.md index 278770b6..bd7d387b 100644 --- a/packages/docs/zh/api/interfaces/NavigationGuardNext.md +++ b/packages/docs/zh/api/interfaces/NavigationGuardNext.md @@ -2,17 +2,17 @@ editLink: false --- -[API Documentation](../index.md) / NavigationGuardNext +[API 参考](../index.md) / NavigationGuardNext -# Interface: NavigationGuardNext +# 接口:NavigationGuardNext %{#interface-navigationguardnext}% -## Callable %{#Callable}% +## 可调用函数 %{#Callable}% ### NavigationGuardNext %{#Callable-NavigationGuardNext}% ▸ **NavigationGuardNext**(): `void` -#### Returns %{#Callable-NavigationGuardNext-Returns}% +#### 返回值 %{#Callable-NavigationGuardNext-Returns}% `void` @@ -20,13 +20,13 @@ editLink: false ▸ **NavigationGuardNext**(`error`): `void` -#### Parameters %{#Callable-NavigationGuardNext-Parameters}% +#### 参数 %{#Callable-NavigationGuardNext-Parameters}% -| Name | Type | +| 名称 | 类型 | | :------ | :------ | | `error` | `Error` | -#### Returns %{#Callable-NavigationGuardNext-Returns_1}% +#### 返回值 %{#Callable-NavigationGuardNext-Returns_1}% `void` @@ -34,13 +34,13 @@ editLink: false ▸ **NavigationGuardNext**(`location`): `void` -#### Parameters %{#Callable-NavigationGuardNext-Parameters_1}% +#### 参数 %{#Callable-NavigationGuardNext-Parameters_1}% -| Name | Type | +| 名称 | 类型 | | :------ | :------ | | `location` | [`RouteLocationRaw`](../index.md#routelocationraw) | -#### Returns %{#Callable-NavigationGuardNext-Returns_2}% +#### 返回值 %{#Callable-NavigationGuardNext-Returns_2}% `void` @@ -48,13 +48,13 @@ editLink: false ▸ **NavigationGuardNext**(`valid`): `void` -#### Parameters %{#Callable-NavigationGuardNext-Parameters_2}% +#### 参数 %{#Callable-NavigationGuardNext-Parameters_2}% -| Name | Type | +| 名称 | 类型 | | :------ | :------ | | `valid` | `undefined` \| `boolean` | -#### Returns %{#Callable-NavigationGuardNext-Returns_3}% +#### 返回值 %{#Callable-NavigationGuardNext-Returns_3}% `void` @@ -62,12 +62,12 @@ editLink: false ▸ **NavigationGuardNext**(`cb`): `void` -#### Parameters %{#Callable-NavigationGuardNext-Parameters_3}% +#### 参数 %{#Callable-NavigationGuardNext-Parameters_3}% -| Name | Type | +| 名称 | 类型 | | :------ | :------ | | `cb` | `NavigationGuardNextCallback` | -#### Returns %{#Callable-NavigationGuardNext-Returns_4}% +#### 返回值 %{#Callable-NavigationGuardNext-Returns_4}% `void` diff --git a/packages/docs/zh/api/interfaces/NavigationGuardWithThis.md b/packages/docs/zh/api/interfaces/NavigationGuardWithThis.md index 2799f4d1..dc89efa7 100644 --- a/packages/docs/zh/api/interfaces/NavigationGuardWithThis.md +++ b/packages/docs/zh/api/interfaces/NavigationGuardWithThis.md @@ -2,34 +2,33 @@ editLink: false --- -[API Documentation](../index.md) / NavigationGuardWithThis +[API 参考](../index.md) / NavigationGuardWithThis -# Interface: NavigationGuardWithThis +# 接口:NavigationGuardWithThis %{#interface-navigationguardwiththis-t}% -## Type parameters %{#Type-parameters}% +## 类型参数 %{#Type-parameters}% | Name | | :------ | | `T` | -## Callable %{#Callable}% +## 可调用函数 %{#Callable}% ### NavigationGuardWithThis %{#Callable-NavigationGuardWithThis}% ▸ **NavigationGuardWithThis**(`this`, `to`, `from`, `next`): `NavigationGuardReturn` \| `Promise`<`NavigationGuardReturn`\> -Navigation guard. See [Navigation -Guards](/guide/advanced/navigation-guards.md). +导航守卫。详情可查阅[导航守卫](/zh/guide/advanced/navigation-guards.md). -#### Parameters %{#Callable-NavigationGuardWithThis-Parameters}% +#### 参数 %{#Callable-NavigationGuardWithThis-Parameters}% -| Name | Type | +| 名称 | 类型 | | :------ | :------ | | `this` | `T` | | `to` | [`RouteLocationNormalized`](RouteLocationNormalized.md) | | `from` | [`RouteLocationNormalized`](RouteLocationNormalized.md) | | `next` | [`NavigationGuardNext`](NavigationGuardNext.md) | -#### Returns %{#Callable-NavigationGuardWithThis-Returns}% +#### 返回值 %{#Callable-NavigationGuardWithThis-Returns}% `NavigationGuardReturn` \| `Promise`<`NavigationGuardReturn`\> diff --git a/packages/docs/zh/api/interfaces/NavigationHookAfter.md b/packages/docs/zh/api/interfaces/NavigationHookAfter.md index 34fe56b2..cbcf3ad7 100644 --- a/packages/docs/zh/api/interfaces/NavigationHookAfter.md +++ b/packages/docs/zh/api/interfaces/NavigationHookAfter.md @@ -2,24 +2,24 @@ editLink: false --- -[API Documentation](../index.md) / NavigationHookAfter +[API 参考](../index.md) / NavigationHookAfter -# Interface: NavigationHookAfter +# 接口:NavigationHookAfter %{#interface-navigationhookafter}% -## Callable %{#Callable}% +## 可调用函数 %{#Callable}% ### NavigationHookAfter %{#Callable-NavigationHookAfter}% ▸ **NavigationHookAfter**(`to`, `from`, `failure?`): `any` -#### Parameters %{#Callable-NavigationHookAfter-Parameters}% +#### 参数 %{#Callable-NavigationHookAfter-Parameters}% -| Name | Type | +| 名称 | 类型 | | :------ | :------ | | `to` | [`RouteLocationNormalized`](RouteLocationNormalized.md) | | `from` | [`RouteLocationNormalized`](RouteLocationNormalized.md) | | `failure?` | `void` \| [`NavigationFailure`](NavigationFailure.md) | -#### Returns %{#Callable-NavigationHookAfter-Returns}% +#### 返回值 %{#Callable-NavigationHookAfter-Returns}% `any` diff --git a/packages/docs/zh/api/interfaces/RouteLocation.md b/packages/docs/zh/api/interfaces/RouteLocation.md index 9a23955a..a9db1b0b 100644 --- a/packages/docs/zh/api/interfaces/RouteLocation.md +++ b/packages/docs/zh/api/interfaces/RouteLocation.md @@ -2,28 +2,27 @@ editLink: false --- -[API Documentation](../index.md) / RouteLocation +[API 参考](../index.md) / RouteLocation -# Interface: RouteLocation +# 接口:RouteLocation %{#interface-routelocation}% -[RouteLocationRaw](../index.md#routelocationraw) resolved using the matcher +通过匹配解析出来的 [RouteLocationRaw](../index.md#routelocationraw) -## Hierarchy %{#Hierarchy}% +## 继承关系 %{#Hierarchy}% - `_RouteLocationBase` ↳ **`RouteLocation`** -## Properties %{#Properties}% +## 属性 %{#Properties}% ### fullPath %{#Properties-fullPath}% • **fullPath**: `string` -The whole location including the `search` and `hash`. This string is -percentage encoded. +包括 `search` 和 `hash` 在内的完整地址。该字符串是经过百分号编码的。 -#### Inherited from %{#Properties-fullPath-Inherited-from}% +#### 继承自 %{#Properties-fullPath-Inherited-from}% \_RouteLocationBase.fullPath @@ -33,9 +32,9 @@ ___ • **hash**: `string` -Hash of the current location. If present, starts with a `#`. +当前地址的 hash。如果存在则以 `#` 开头。 -#### Inherited from %{#Properties-hash-Inherited-from}% +#### 继承自 %{#Properties-hash-Inherited-from}% \_RouteLocationBase.hash @@ -45,9 +44,7 @@ ___ • **matched**: [`RouteRecordNormalized`](RouteRecordNormalized.md)[] -Array of [RouteRecord](../index.md#routerecord) containing components as they were -passed when adding records. It can also contain redirect records. This -can't be used directly +包含添加记录时被传入的 [RouteRecord](../index.md#routerecord) 的数组。它也可以包含重定向记录。不能直接使用。 ___ @@ -55,9 +52,9 @@ ___ • **meta**: [`RouteMeta`](RouteMeta.md) -Merged `meta` properties from all the matched route records. +从所有匹配的路由记录中合并的 `meta` 属性。 -#### Inherited from %{#Properties-meta-Inherited-from}% +#### 继承自 %{#Properties-meta-Inherited-from}% \_RouteLocationBase.meta @@ -67,9 +64,9 @@ ___ • **name**: `undefined` \| ``null`` \| [`RouteRecordName`](../index.md#routerecordname) -Name of the matched record +匹配的路由名称。 -#### Inherited from %{#Properties-name-Inherited-from}% +#### 继承自 %{#Properties-name-Inherited-from}% \_RouteLocationBase.name @@ -79,9 +76,9 @@ ___ • **params**: [`RouteParams`](../index.md#routeparams) -Object of decoded params extracted from the `path`. +从 `path` 中提取出来并解码后的参数对象。 -#### Inherited from %{#Properties-params-Inherited-from}% +#### 继承自 %{#Properties-params-Inherited-from}% \_RouteLocationBase.params @@ -91,9 +88,9 @@ ___ • **path**: `string` -Percentage encoded pathname section of the URL. +经过百分号编码的 URL 中的 pathname 段。 -#### Inherited from %{#Properties-path-Inherited-from}% +#### 继承自 %{#Properties-path-Inherited-from}% \_RouteLocationBase.path @@ -103,9 +100,9 @@ ___ • **query**: [`LocationQuery`](../index.md#locationquery) -Object representation of the `search` property of the current location. +代表当前地址的 `search` 属性的对象 -#### Inherited from %{#Properties-query-Inherited-from}% +#### 继承自 %{#Properties-query-Inherited-from}% \_RouteLocationBase.query @@ -115,9 +112,8 @@ ___ • **redirectedFrom**: `undefined` \| [`RouteLocation`](RouteLocation.md) -Contains the location we were initially trying to access before ending up -on the current location. +包含在重定向到当前地址之前,我们最初想访问的地址。 -#### Inherited from %{#Properties-redirectedFrom-Inherited-from}% +#### 继承自 %{#Properties-redirectedFrom-Inherited-from}% \_RouteLocationBase.redirectedFrom diff --git a/packages/docs/zh/api/interfaces/RouteLocationMatched.md b/packages/docs/zh/api/interfaces/RouteLocationMatched.md index 446feb12..3b8d0898 100644 --- a/packages/docs/zh/api/interfaces/RouteLocationMatched.md +++ b/packages/docs/zh/api/interfaces/RouteLocationMatched.md @@ -2,28 +2,27 @@ editLink: false --- -[API Documentation](../index.md) / RouteLocationMatched +[API 参考](../index.md) / RouteLocationMatched -# Interface: RouteLocationMatched +# 接口:RouteLocationMatched -Normalized version of a [route record](../index.md#routerecord). +一条[路由记录](../index.md#routerecord)的规范化版本。 -## Hierarchy %{#Hierarchy}% +## 继承关系 %{#Hierarchy}% - [`RouteRecordNormalized`](RouteRecordNormalized.md) ↳ **`RouteLocationMatched`** -## Properties %{#Properties}% +## 属性 %{#Properties}% ### aliasOf %{#Properties-aliasOf}% • **aliasOf**: `undefined` \| [`RouteRecordNormalized`](RouteRecordNormalized.md) -Defines if this record is the alias of another one. This property is -`undefined` if the record is the original one. +定义了是否这条记录是另一条的别名。如果记录是原始记录,则该属性为 `undefined`。 -#### Inherited from %{#Properties-aliasOf-Inherited-from}% +#### 继承自 %{#Properties-aliasOf-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[aliasOf](RouteRecordNormalized.md#aliasof) @@ -33,9 +32,9 @@ ___ • **beforeEnter**: `undefined` \| [`NavigationGuardWithThis`](NavigationGuardWithThis.md)<`undefined`\> \| [`NavigationGuardWithThis`](NavigationGuardWithThis.md)<`undefined`\>[] -Registered beforeEnter guards +被注册的 beforeEnter 守卫 -#### Inherited from %{#Properties-beforeEnter-Inherited-from}% +#### 继承自 %{#Properties-beforeEnter-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[beforeEnter](RouteRecordNormalized.md#beforeenter) @@ -45,9 +44,9 @@ ___ • **children**: [`RouteRecordRaw`](../index.md#routerecordraw)[] -Nested route records. +嵌套的路由记录。 -#### Inherited from %{#Properties-children-Inherited-from}% +#### 继承自 %{#Properties-children-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[children](RouteRecordNormalized.md#children) @@ -59,7 +58,7 @@ ___ {@inheritDoc RouteRecordMultipleViews.components} -#### Overrides %{#Properties-components-Overrides}% +#### Override %{#Properties-components-Overrides}% [RouteRecordNormalized](RouteRecordNormalized.md).[components](RouteRecordNormalized.md#components) @@ -69,15 +68,11 @@ ___ • **instances**: `Record`<`string`, `undefined` \| ``null`` \| `ComponentPublicInstance`<{}, {}, {}, {}, {}, {}, {}, {}, ``false``, `ComponentOptionsBase`<`any`, `any`, `any`, `any`, `any`, `any`, `any`, `any`, `any`, {}, {}, `string`\>, {}\>\> -Mounted route component instances -Having the instances on the record mean beforeRouteUpdate and -beforeRouteLeave guards can only be invoked with the latest mounted app -instance if there are multiple application instances rendering the same -view, basically duplicating the content on the page, which shouldn't happen -in practice. It will work if multiple apps are rendering different named -views. + -#### Inherited from %{#Properties-instances-Inherited-from}% +Mounted route component instance。 Having the instances on the record mean beforeRouteUpdate and beforeRouteLeave guards can only be invoked with the latest mounted app instance if there are multiple application instances rendering the same view, basically duplicating the content on the page, which shouldn't happen in practice. It will work if multiple apps are rendering different named views. + +#### 继承自 %{#Properties-instances-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[instances](RouteRecordNormalized.md#instances) @@ -89,7 +84,7 @@ ___ {@inheritDoc _RouteRecordBase.meta} -#### Inherited from %{#Properties-meta-Inherited-from}% +#### 继承自 %{#Properties-meta-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[meta](RouteRecordNormalized.md#meta) @@ -101,7 +96,7 @@ ___ {@inheritDoc _RouteRecordBase.name} -#### Inherited from %{#Properties-name-Inherited-from}% +#### 继承自 %{#Properties-name-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[name](RouteRecordNormalized.md#name) @@ -113,7 +108,7 @@ ___ {@inheritDoc _RouteRecordBase.path} -#### Inherited from %{#Properties-path-Inherited-from}% +#### 继承自 %{#Properties-path-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[path](RouteRecordNormalized.md#path) @@ -125,7 +120,7 @@ ___ {@inheritDoc RouteRecordMultipleViews.props} -#### Inherited from %{#Properties-props-Inherited-from}% +#### 继承自 %{#Properties-props-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[props](RouteRecordNormalized.md#props) @@ -137,6 +132,6 @@ ___ {@inheritDoc _RouteRecordBase.redirect} -#### Inherited from %{#Properties-redirect-Inherited-from}% +#### 继承自 %{#Properties-redirect-Inherited-from}% [RouteRecordNormalized](RouteRecordNormalized.md).[redirect](RouteRecordNormalized.md#redirect) diff --git a/packages/docs/zh/api/interfaces/RouteLocationNormalized.md b/packages/docs/zh/api/interfaces/RouteLocationNormalized.md index 2e49471d..820dc7e5 100644 --- a/packages/docs/zh/api/interfaces/RouteLocationNormalized.md +++ b/packages/docs/zh/api/interfaces/RouteLocationNormalized.md @@ -2,29 +2,27 @@ editLink: false --- -[API Documentation](../index.md) / RouteLocationNormalized +[API 参考](../index.md) / RouteLocationNormalized -# Interface: RouteLocationNormalized +# 接口:RouteLocationNormalized -Similar to [RouteLocation](RouteLocation.md) but its -[matched](RouteLocationNormalized.md#matched) cannot contain redirect records +和 [RouteLocation](RouteLocation.md) 类似但是其 [matched](RouteLocationNormalized.md#matched) 无法包含重定向的记录 -## Hierarchy %{#Hierarchy}% +## 继承关系 %{#Hierarchy}% - `_RouteLocationBase` ↳ **`RouteLocationNormalized`** -## Properties %{#Properties}% +## 属性 %{#Properties}% ### fullPath %{#Properties-fullPath}% • **fullPath**: `string` -The whole location including the `search` and `hash`. This string is -percentage encoded. +包括 `search` 和 `hash` 在内的完整地址。该字符串是经过百分号编码的。 -#### Inherited from %{#Properties-fullPath-Inherited-from}% +#### 继承自 %{#Properties-fullPath-Inherited-from}% \_RouteLocationBase.fullPath @@ -34,9 +32,9 @@ ___ • **hash**: `string` -Hash of the current location. If present, starts with a `#`. +当前地址的 hash。如果存在则以 `#` 开头。 -#### Inherited from %{#Properties-hash-Inherited-from}% +#### 继承自 %{#Properties-hash-Inherited-from}% \_RouteLocationBase.hash @@ -46,7 +44,7 @@ ___ • **matched**: [`RouteRecordNormalized`](RouteRecordNormalized.md)[] -Array of [RouteRecordNormalized](RouteRecordNormalized.md) +[RouteRecordNormalized](RouteRecordNormalized.md) 数组。 ___ @@ -54,9 +52,9 @@ ___ • **meta**: [`RouteMeta`](RouteMeta.md) -Merged `meta` properties from all the matched route records. +从所有匹配的路由记录中合并的 `meta` 属性。 -#### Inherited from %{#Properties-meta-Inherited-from}% +#### 继承自 %{#Properties-meta-Inherited-from}% \_RouteLocationBase.meta @@ -66,9 +64,9 @@ ___ • **name**: `undefined` \| ``null`` \| [`RouteRecordName`](../index.md#routerecordname) -Name of the matched record +匹配的路由名称。 -#### Inherited from %{#Properties-name-Inherited-from}% +#### 继承自 %{#Properties-name-Inherited-from}% \_RouteLocationBase.name @@ -78,9 +76,9 @@ ___ • **params**: [`RouteParams`](../index.md#routeparams) -Object of decoded params extracted from the `path`. +从 `path` 中提取出来并解码后的参数对象。 -#### Inherited from %{#Properties-params-Inherited-from}% +#### 继承自 %{#Properties-params-Inherited-from}% \_RouteLocationBase.params @@ -90,9 +88,9 @@ ___ • **path**: `string` -Percentage encoded pathname section of the URL. +经过百分号编码的 URL 中的 pathname 段。 -#### Inherited from %{#Properties-path-Inherited-from}% +#### 继承自 %{#Properties-path-Inherited-from}% \_RouteLocationBase.path @@ -102,9 +100,9 @@ ___ • **query**: [`LocationQuery`](../index.md#locationquery) -Object representation of the `search` property of the current location. +代表当前地址的 `search` 属性的对象 -#### Inherited from %{#Properties-query-Inherited-from}% +#### 继承自 %{#Properties-query-Inherited-from}% \_RouteLocationBase.query @@ -114,9 +112,8 @@ ___ • **redirectedFrom**: `undefined` \| [`RouteLocation`](RouteLocation.md) -Contains the location we were initially trying to access before ending up -on the current location. +包含在重定向到当前地址之前,我们最初想访问的地址。 -#### Inherited from %{#Properties-redirectedFrom-Inherited-from}% +#### 继承自 %{#Properties-redirectedFrom-Inherited-from}% \_RouteLocationBase.redirectedFrom diff --git a/packages/docs/zh/api/interfaces/RouteLocationNormalizedLoaded.md b/packages/docs/zh/api/interfaces/RouteLocationNormalizedLoaded.md index 0f3b828a..07314567 100644 --- a/packages/docs/zh/api/interfaces/RouteLocationNormalizedLoaded.md +++ b/packages/docs/zh/api/interfaces/RouteLocationNormalizedLoaded.md @@ -2,28 +2,29 @@ editLink: false --- -[API Documentation](../index.md) / RouteLocationNormalizedLoaded +[API 参考](../index.md) / RouteLocationNormalizedLoaded -# Interface: RouteLocationNormalizedLoaded +# 接口:RouteLocationNormalizedLoaded + + [RouteLocationRaw](../index.md#routelocationraw) with -## Hierarchy %{#Hierarchy}% +## 继承关系 %{#Hierarchy}% - `_RouteLocationBase` ↳ **`RouteLocationNormalizedLoaded`** -## Properties %{#Properties}% +## 属性 %{#Properties}% ### fullPath %{#Properties-fullPath}% • **fullPath**: `string` -The whole location including the `search` and `hash`. This string is -percentage encoded. +包括 `search` 和 `hash` 在内的完整地址。该字符串是经过百分号编码的。 -#### Inherited from %{#Properties-fullPath-Inherited-from}% +#### 继承自 %{#Properties-fullPath-Inherited-from}% \_RouteLocationBase.fullPath @@ -33,9 +34,9 @@ ___ • **hash**: `string` -Hash of the current location. If present, starts with a `#`. +当前地址的 hash。如果存在则以 `#` 开头。 -#### Inherited from %{#Properties-hash-Inherited-from}% +#### 继承自 %{#Properties-hash-Inherited-from}% \_RouteLocationBase.hash @@ -45,10 +46,7 @@ ___ • **matched**: [`RouteLocationMatched`](RouteLocationMatched.md)[] -Array of [RouteLocationMatched](RouteLocationMatched.md) containing only plain components (any -lazy-loaded components have been loaded and were replaced inside the -`components` object) so it can be directly used to display routes. It -cannot contain redirect records either +[RouteLocationMatched](RouteLocationMatched.md) 数组,只包含直接的组件 (任何已被加载并在 `components` 对象内被替换掉的懒加载组件)。所以它可以被直接用于展示路由。同样它不包含重定向的记录。 ___ @@ -56,9 +54,9 @@ ___ • **meta**: [`RouteMeta`](RouteMeta.md) -Merged `meta` properties from all the matched route records. +从所有匹配的路由记录中合并的 `meta` 属性。 -#### Inherited from %{#Properties-meta-Inherited-from}% +#### 继承自 %{#Properties-meta-Inherited-from}% \_RouteLocationBase.meta @@ -68,9 +66,9 @@ ___ • **name**: `undefined` \| ``null`` \| [`RouteRecordName`](../index.md#routerecordname) -Name of the matched record +匹配的路由名称。 -#### Inherited from %{#Properties-name-Inherited-from}% +#### 继承自 %{#Properties-name-Inherited-from}% \_RouteLocationBase.name @@ -80,9 +78,9 @@ ___ • **params**: [`RouteParams`](../index.md#routeparams) -Object of decoded params extracted from the `path`. +从 `path` 中提取出来并解码后的参数对象。 -#### Inherited from %{#Properties-params-Inherited-from}% +#### 继承自 %{#Properties-params-Inherited-from}% \_RouteLocationBase.params @@ -92,9 +90,9 @@ ___ • **path**: `string` -Percentage encoded pathname section of the URL. +经过百分号编码的 URL 中的 pathname 段。 -#### Inherited from %{#Properties-path-Inherited-from}% +#### 继承自 %{#Properties-path-Inherited-from}% \_RouteLocationBase.path @@ -104,9 +102,9 @@ ___ • **query**: [`LocationQuery`](../index.md#locationquery) -Object representation of the `search` property of the current location. +代表当前地址的 `search` 属性的对象 -#### Inherited from %{#Properties-query-Inherited-from}% +#### 继承自 %{#Properties-query-Inherited-from}% \_RouteLocationBase.query @@ -116,9 +114,8 @@ ___ • **redirectedFrom**: `undefined` \| [`RouteLocation`](RouteLocation.md) -Contains the location we were initially trying to access before ending up -on the current location. +包含在重定向到当前地址之前,我们最初想访问的地址。 -#### Inherited from %{#Properties-redirectedFrom-Inherited-from}% +#### 继承自 %{#Properties-redirectedFrom-Inherited-from}% \_RouteLocationBase.redirectedFrom diff --git a/packages/docs/zh/api/interfaces/RouteLocationOptions.md b/packages/docs/zh/api/interfaces/RouteLocationOptions.md index 488dc576..c12a05b7 100644 --- a/packages/docs/zh/api/interfaces/RouteLocationOptions.md +++ b/packages/docs/zh/api/interfaces/RouteLocationOptions.md @@ -2,36 +2,32 @@ editLink: false --- -[API Documentation](../index.md) / RouteLocationOptions +[API 参考](../index.md) / RouteLocationOptions -# Interface: RouteLocationOptions +# 接口:RouteLocationOptions -Common options for all navigation methods. +对所有导航方法通用的选项。 -## Properties %{#Properties}% +## 属性 %{#Properties}% ### force %{#Properties-force}% -• `Optional` **force**: `boolean` +• `可选` **force**: `boolean` -Triggers the navigation even if the location is the same as the current one. -Note this will also add a new entry to the history unless `replace: true` -is passed. +触发导航,即使该地址与当前地址相同。请注意,这也会新添加一条历史记录,除非传入 `replace: true`。 ___ ### replace %{#Properties-replace}% -• `Optional` **replace**: `boolean` +• `可选` **replace**: `boolean` -Replace the entry in the history instead of pushing a new entry +替换而不是加入一个新的历史记录。 ___ ### state %{#Properties-state}% -• `Optional` **state**: [`HistoryState`](HistoryState.md) +• `可选` **state**: [`HistoryState`](HistoryState.md) -State to save using the History API. This cannot contain any reactive -values and some primitives like Symbols are forbidden. More info at -https://developer.mozilla.org/en-US/docs/Web/API/History/state +使用 History API 保存的状态。它不能包含任何响应性的值,同时一些诸如 Symbol 的基础类型是被禁用的。更多信息见 https://developer.mozilla.org/en-US/docs/Web/API/History/state diff --git a/packages/docs/zh/api/interfaces/RouteMeta.md b/packages/docs/zh/api/interfaces/RouteMeta.md index 344ab4ab..d7fdb4c0 100644 --- a/packages/docs/zh/api/interfaces/RouteMeta.md +++ b/packages/docs/zh/api/interfaces/RouteMeta.md @@ -2,16 +2,16 @@ editLink: false --- -[API Documentation](../index.md) / RouteMeta +[API 参考](../index.md) / RouteMeta -# Interface: RouteMeta +# 接口:RouteMeta -Interface to type `meta` fields in route records. +路由记录中的 `meta` 字段的类型接口。 **`Example`** ```ts -// typings.d.ts or router.ts +// typings.d.ts 或 router.ts import 'vue-router'; declare module 'vue-router' { @@ -21,7 +21,7 @@ declare module 'vue-router' { } ``` -## Hierarchy %{#Hierarchy}% +## 继承关系 %{#Hierarchy}% - `Record`<`string` \| `number` \| `symbol`, `unknown`\> diff --git a/packages/docs/zh/api/interfaces/RouteRecordNormalized.md b/packages/docs/zh/api/interfaces/RouteRecordNormalized.md index a2a800b9..4ac724ed 100644 --- a/packages/docs/zh/api/interfaces/RouteRecordNormalized.md +++ b/packages/docs/zh/api/interfaces/RouteRecordNormalized.md @@ -2,26 +2,25 @@ editLink: false --- -[API Documentation](../index.md) / RouteRecordNormalized +[API 参考](../index.md) / RouteRecordNormalized -# Interface: RouteRecordNormalized +# 接口:RouteRecordNormalized -Normalized version of a [route record](../index.md#routerecord). +一条[路由记录](../index.md#routerecord)的规范化版本。 -## Hierarchy %{#Hierarchy}% +## 继承关系 %{#Hierarchy}% - **`RouteRecordNormalized`** ↳ [`RouteLocationMatched`](RouteLocationMatched.md) -## Properties %{#Properties}% +## 属性 %{#Properties}% ### aliasOf %{#Properties-aliasOf}% • **aliasOf**: `undefined` \| [`RouteRecordNormalized`](RouteRecordNormalized.md) -Defines if this record is the alias of another one. This property is -`undefined` if the record is the original one. +定义了是否这条记录是另一条的别名。如果记录是原始记录,则该属性为 `undefined`。 ___ @@ -29,7 +28,7 @@ ___ • **beforeEnter**: `undefined` \| [`NavigationGuardWithThis`](NavigationGuardWithThis.md)<`undefined`\> \| [`NavigationGuardWithThis`](NavigationGuardWithThis.md)<`undefined`\>[] -Registered beforeEnter guards +被注册的 beforeEnter 守卫 ___ @@ -37,7 +36,7 @@ ___ • **children**: [`RouteRecordRaw`](../index.md#routerecordraw)[] -Nested route records. +嵌套的路由记录。 ___ @@ -53,6 +52,8 @@ ___ • **instances**: `Record`<`string`, `undefined` \| ``null`` \| `ComponentPublicInstance`<{}, {}, {}, {}, {}, {}, {}, {}, ``false``, `ComponentOptionsBase`<`any`, `any`, `any`, `any`, `any`, `any`, `any`, `any`, `any`, {}, {}, `string`\>, {}\>\> + + Mounted route component instances Having the instances on the record mean beforeRouteUpdate and beforeRouteLeave guards can only be invoked with the latest mounted app diff --git a/packages/docs/zh/api/interfaces/Router.md b/packages/docs/zh/api/interfaces/Router.md index 001f95c4..ae8f773b 100644 --- a/packages/docs/zh/api/interfaces/Router.md +++ b/packages/docs/zh/api/interfaces/Router.md @@ -2,17 +2,19 @@ editLink: false --- -[API Documentation](../index.md) / Router + -# Interface: Router +[API 参考](../index.md) / Router + +# 接口:Router 路由器实例。 -## Properties %{#Properties}% +## 属性 %{#Properties}% ### currentRoute %{#Properties-currentRoute}% -• `Readonly` **currentRoute**: `Ref`<[`RouteLocationNormalizedLoaded`](RouteLocationNormalizedLoaded.md)\> +• `只读` **currentRoute**: `Ref`<[`RouteLocationNormalizedLoaded`](RouteLocationNormalizedLoaded.md)\> 当前的 [RouteLocationNormalized](RouteLocationNormalized.md)。 @@ -28,7 +30,7 @@ ___ ### options %{#Properties-options}% -• `Readonly` **options**: [`RouterOptions`](RouterOptions.md) +• `只读` **options**: [`RouterOptions`](RouterOptions.md) 创建路由器时的原始选项对象。 @@ -40,14 +42,14 @@ ___ 添加一个新的[路由记录](../index.md#routerecordraw),将其作为一个已有路由的子路由。 -#### Parameters %{#Methods-addRoute-Parameters}% +#### 参数 %{#Methods-addRoute-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `parentName` | [`RouteRecordName`](../index.md#routerecordname) | `route` 应该被加入到的父级路由记录 | | `route` | [`RouteRecordRaw`](../index.md#routerecordraw) | 要加入的路由记录 | -#### Returns %{#Methods-addRoute-Returns}% +#### 返回值 %{#Methods-addRoute-Returns}% `fn` @@ -55,7 +57,7 @@ ___ 添加一个新的[路由记录](../index.md#routerecordraw),将其作为一个已有路由的子路由。 -##### Returns %{#Methods-addRoute-Returns-Returns}% +##### 返回值 %{#Methods-addRoute-Returns-Returns}% `void` @@ -63,13 +65,13 @@ ___ 添加一个新的[路由记录](../index.md#routerecordraw)到该路由器中。 -#### Parameters %{#Methods-addRoute-Parameters_1}% +#### 参数 %{#Methods-addRoute-Parameters_1}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `route` | [`RouteRecordRaw`](../index.md#routerecordraw) | 要加入的路由记录 | -#### Returns %{#Methods-addRoute-Returns_1}% +#### 返回值 %{#Methods-addRoute-Returns_1}% `fn` @@ -77,7 +79,7 @@ ___ 添加一个新的[路由记录](../index.md#routerecordraw)到该路由器中。 -##### Returns %{#Methods-addRoute-Returns-Returns_1}% +##### 返回值 %{#Methods-addRoute-Returns-Returns_1}% `void` @@ -99,13 +101,13 @@ router.afterEach((to, from, failure) => { }) ``` -#### Parameters %{#Methods-afterEach-Parameters}% +#### 参数 %{#Methods-afterEach-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `guard` | [`NavigationHookAfter`](NavigationHookAfter.md) | 要加入的导航钩子 | -#### Returns %{#Methods-afterEach-Returns}% +#### 返回值 %{#Methods-afterEach-Returns}% `fn` @@ -123,7 +125,7 @@ router.afterEach((to, from, failure) => { }) ``` -##### Returns %{#Methods-afterEach-Returns-Returns}% +##### 返回值 %{#Methods-afterEach-Returns-Returns}% `void` @@ -135,7 +137,7 @@ ___ 通过调用 `history.back()` 在可能的情况下在历史中后退。相当于 `router.go(-1)`。 -#### Returns %{#Methods-back-Returns}% +#### 返回值 %{#Methods-back-Returns}% `void` @@ -147,13 +149,13 @@ ___ 添加一个导航钩子,它会在每次导航之前被执行。返回一个用来移除该钩子的函数。 -#### Parameters %{#Methods-beforeEach-Parameters}% +#### 参数 %{#Methods-beforeEach-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `guard` | [`NavigationGuardWithThis`](NavigationGuardWithThis.md)<`undefined`\> | 要加入的导航钩子 | -#### Returns %{#Methods-beforeEach-Returns}% +#### 返回值 %{#Methods-beforeEach-Returns}% `fn` @@ -161,7 +163,7 @@ ___ 添加一个导航钩子,它会在每次导航之前被执行。返回一个用来移除该钩子的函数。 -##### Returns %{#Methods-beforeEach-Returns-Returns}% +##### 返回值 %{#Methods-beforeEach-Returns-Returns}% `void` @@ -181,13 +183,13 @@ router.beforeResolve(to => { }) ``` -#### Parameters %{#Methods-beforeResolve-Parameters}% +#### 参数 %{#Methods-beforeResolve-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `guard` | [`NavigationGuardWithThis`](NavigationGuardWithThis.md)<`undefined`\> | navigation guard to add | -#### Returns %{#Methods-beforeResolve-Returns}% +#### 返回值 %{#Methods-beforeResolve-Returns}% `fn` @@ -203,7 +205,7 @@ router.beforeResolve(to => { }) ``` -##### Returns %{#Methods-beforeResolve-Returns-Returns}% +##### 返回值 %{#Methods-beforeResolve-Returns-Returns}% `void` @@ -215,7 +217,7 @@ ___ 通过调用 `history.forward()` 在可能的情况下在历史中前进。相当于 `router.go(1)`。 -#### Returns %{#Methods-forward-Returns}% +#### 返回值 %{#Methods-forward-Returns}% `void` @@ -227,7 +229,7 @@ ___ 获得所有[路由记录](../index.md#routerecord)的完整列表。 -#### Returns %{#Methods-getRoutes-Returns}% +#### 返回值 %{#Methods-getRoutes-Returns}% [`RouteRecordNormalized`](RouteRecordNormalized.md)[] @@ -239,13 +241,13 @@ ___ 允许你在历史中前进或后退。相当于 `router.go()`。 -#### Parameters %{#Methods-go-Parameters}% +#### 参数 %{#Methods-go-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `delta` | `number` | 相对于当前页面你想要移动到的历史中的位置 | -#### Returns %{#Methods-go-Returns}% +#### 返回值 %{#Methods-go-Returns}% `void` @@ -257,13 +259,13 @@ ___ 检查一个给定名称的路由是否存在。 -#### Parameters %{#Methods-hasRoute-Parameters}% +#### 参数 %{#Methods-hasRoute-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `name` | [`RouteRecordName`](../index.md#routerecordname) | 要检查的路由名称 | -#### Returns %{#Methods-hasRoute-Returns}% +#### 返回值 %{#Methods-hasRoute-Returns}% `boolean` @@ -277,7 +279,7 @@ ___ 这在服务端渲染中确认服务端和客户端输出一致的时候非常有用。注意在服务端你需要手动加入初始地址,而在客户端,路由器会从 URL 中自动获取。 -#### Returns %{#Methods-isReady-Returns}% +#### 返回值 %{#Methods-isReady-Returns}% `Promise`<`void`\> @@ -289,13 +291,13 @@ ___ 添加一个错误处理器,它会在每次导航遇到未被捕获的错误出现时被调用。其中包括同步和异步被抛出的错误、在任何导航守卫中返回或传入 `next` 的错误、尝试解析一个需要渲染路由的异步组件时发生的错误。 -#### Parameters %{#Methods-onError-Parameters}% +#### 参数 %{#Methods-onError-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `handler` | `_ErrorHandler` | 要注册的错误处理器 | -#### Returns %{#Methods-onError-Returns}% +#### 返回值 %{#Methods-onError-Returns}% `fn` @@ -303,7 +305,7 @@ ___ 添加一个错误处理器,它会在每次导航遇到未被捕获的错误出现时被调用。其中包括同步和异步被抛出的错误、在任何导航守卫中返回或传入 `next` 的错误、尝试解析一个需要渲染路由的异步组件时发生的错误。 -##### Returns %{#Methods-onError-Returns-Returns}% +##### 返回值 %{#Methods-onError-Returns-Returns}% `void` @@ -315,13 +317,13 @@ ___ 程序式地通过将一条记录加入到历史栈中来导航到一个新的 URL。 -#### Parameters %{#Methods-push-Parameters}% +#### 参数 %{#Methods-push-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `to` | [`RouteLocationRaw`](../index.md#routelocationraw) | 要导航到的路由 | -#### Returns %{#Methods-push-Returns}% +#### 返回值 %{#Methods-push-Returns}% `Promise`<`undefined` \| `void` \| [`NavigationFailure`](NavigationFailure.md)\> @@ -333,13 +335,13 @@ ___ 根据其名称移除一个现有的路由。 -#### Parameters %{#Methods-removeRoute-Parameters}% +#### 参数 %{#Methods-removeRoute-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `name` | [`RouteRecordName`](../index.md#routerecordname) | 要移除的路由名称 | -#### Returns %{#Methods-removeRoute-Returns}% +#### 返回值 %{#Methods-removeRoute-Returns}% `void` @@ -351,13 +353,13 @@ ___ 程序式地通过替换历史栈中的当前记录来导航到一个新的 URL。 -#### Parameters %{#Methods-replace-Parameters}% +#### 参数 %{#Methods-replace-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `to` | [`RouteLocationRaw`](../index.md#routelocationraw) | 要导航到的路由 | -#### Returns %{#Methods-replace-Returns}% +#### 返回值 %{#Methods-replace-Returns}% `Promise`<`undefined` \| `void` \| [`NavigationFailure`](NavigationFailure.md)\> @@ -369,13 +371,13 @@ ___ 返回一个[路由地址](../index.md#routelocationraw)的[规范化版本](RouteLocation.md)。同时包含一个包含任何现有 `base` 的 `href` 属性。默认情况下,用于 `router.currentRoute` 的 `currentLocation` 应该在特别高阶的用例下才会被覆写。 -#### Parameters %{#Methods-resolve-Parameters}% +#### 参数 %{#Methods-resolve-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `to` | [`RouteLocationRaw`](../index.md#routelocationraw) | 要解析的原始路由地址 | | `currentLocation?` | [`RouteLocationNormalizedLoaded`](RouteLocationNormalizedLoaded.md) | 可选的被解析的当前地址 | -#### Returns %{#Methods-resolve-Returns}% +#### 返回值 %{#Methods-resolve-Returns}% [`RouteLocation`](RouteLocation.md) & { `href`: `string` } diff --git a/packages/docs/zh/api/interfaces/RouterHistory.md b/packages/docs/zh/api/interfaces/RouterHistory.md index 7349c181..8f94710d 100644 --- a/packages/docs/zh/api/interfaces/RouterHistory.md +++ b/packages/docs/zh/api/interfaces/RouterHistory.md @@ -2,38 +2,35 @@ editLink: false --- -[API Documentation](../index.md) / RouterHistory +[API 参考](../index.md) / RouterHistory -# Interface: RouterHistory +# 接口:RouterHistory -Interface implemented by History implementations that can be passed to the -router as Router.history +由 History 实现的接口,可以作为 Router.history 传递给路由器。 -## Properties %{#Properties}% +## 属性 %{#Properties}% ### base %{#Properties-base}% -• `Readonly` **base**: `string` +• `只读` **base**: `string` -Base path that is prepended to every url. This allows hosting an SPA at a -sub-folder of a domain like `example.com/sub-folder` by having a `base` of -`/sub-folder` +基准路径,它被预置到每个 URL 上。这允许在一个域名子文件夹中托管 SPA,例如将 `base` 设置为 `/sub-folder` 使得其托管在 `example.com/sub-folder`。 ___ ### location %{#Properties-location}% -• `Readonly` **location**: `string` +• `只读` **location**: `string` -Current History location +当前历史的地址 ___ ### state %{#Properties-state}% -• `Readonly` **state**: [`HistoryState`](HistoryState.md) +• `只读` **state**: [`HistoryState`](HistoryState.md) -Current History state +当前历史的状态 ## Methods %{#Methods}% @@ -41,15 +38,15 @@ Current History state ▸ **createHref**(`location`): `string` -Generates the corresponding href to be used in an anchor tag. +生成用于链接标签的相应的 href。 -#### Parameters %{#Methods-createHref-Parameters}% +#### 参数 %{#Methods-createHref-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | -| `location` | `string` | history location that should create an href | +| `location` | `string` | 应该创建一个 href 的历史的地址 | -#### Returns %{#Methods-createHref-Returns}% +#### 返回值 %{#Methods-createHref-Returns}% `string` @@ -59,9 +56,9 @@ ___ ▸ **destroy**(): `void` -Clears any event listener attached by the history implementation. +清除任何通过该历史实现附加的事件监听器。 -#### Returns %{#Methods-destroy-Returns}% +#### 返回值 %{#Methods-destroy-Returns}% `void` @@ -71,7 +68,7 @@ ___ ▸ **go**(`delta`, `triggerListeners?`): `void` -Traverses history in a given direction. +按指定方向访问历史。 **`Example`** @@ -80,14 +77,14 @@ myHistory.go(-1) // equivalent to window.history.back() myHistory.go(1) // equivalent to window.history.forward() ``` -#### Parameters %{#Methods-go-Parameters}% +#### 参数 %{#Methods-go-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | -| `delta` | `number` | distance to travel. If delta is \< 0, it will go back, if it's \> 0, it will go forward by that amount of entries. | -| `triggerListeners?` | `boolean` | whether this should trigger listeners attached to the history | +| `delta` | `number` | 访问的距离。如果 delta \< 0 则后退相应数量的记录,如果 \> 0 则前进。 | +| `triggerListeners?` | `boolean` | 是否应该触发连接到该历史的监听器 | -#### Returns %{#Methods-go-Returns}% +#### 返回值 %{#Methods-go-Returns}% `void` @@ -97,35 +94,29 @@ ___ ▸ **listen**(`callback`): () => `void` -Attach a listener to the History implementation that is triggered when the -navigation is triggered from outside (like the Browser back and forward -buttons) or when passing `true` to RouterHistory.back and -RouterHistory.forward +给历史实现附加一个监听器,当导航从外部被触发时 (像浏览器的前进后退按钮) 或者向 RouterHistory.back 和 RouterHistory.forward 传递 `true` 时,监听器就会被触发。 -#### Parameters %{#Methods-listen-Parameters}% +#### 参数 %{#Methods-listen-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | -| `callback` | `NavigationCallback` | listener to attach | +| `callback` | `NavigationCallback` | 附加的监听器 | -#### Returns %{#Methods-listen-Returns}% +#### 返回值 %{#Methods-listen-Returns}% `fn` -a callback to remove the listener +用来移除该监听器的回调函数。 ▸ (): `void` -Attach a listener to the History implementation that is triggered when the -navigation is triggered from outside (like the Browser back and forward -buttons) or when passing `true` to RouterHistory.back and -RouterHistory.forward +给历史实现附加一个监听器,当导航从外部被触发时 (像浏览器的前进后退按钮) 或者向 RouterHistory.back 和 RouterHistory.forward 传递 `true` 时,监听器就会被触发。 -##### Returns %{#Methods-listen-Returns-Returns}% +##### 返回值 %{#Methods-listen-Returns-Returns}% `void` -a callback to remove the listener +用来移除该监听器的回调函数。 ___ @@ -133,17 +124,16 @@ ___ ▸ **push**(`to`, `data?`): `void` -Navigates to a location. In the case of an HTML5 History implementation, -this will call `history.pushState` to effectively change the URL. +导航到一个地址。在 HTML5 历史实现下,这将调用 `history.pushState` 来有效改变 URL。 -#### Parameters %{#Methods-push-Parameters}% +#### 参数 %{#Methods-push-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | | `to` | `string` | location to push | -| `data?` | [`HistoryState`](HistoryState.md) | optional [HistoryState](HistoryState.md) to be associated with the navigation entry | +| `data?` | [`HistoryState`](HistoryState.md) | 可选的 [HistoryState](HistoryState.md) 以关联该导航记录 | -#### Returns %{#Methods-push-Returns}% +#### 返回值 %{#Methods-push-Returns}% `void` @@ -153,16 +143,16 @@ ___ ▸ **replace**(`to`, `data?`): `void` -Same as [push](RouterHistory.md#push) but performs a `history.replaceState` -instead of `history.pushState` +和 [push](RouterHistory.md#push) 相同,只是执行了 `history.replaceState` +以换掉 `history.pushState`。 -#### Parameters %{#Methods-replace-Parameters}% +#### 参数 %{#Methods-replace-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | -| `to` | `string` | location to set | -| `data?` | [`HistoryState`](HistoryState.md) | optional [HistoryState](HistoryState.md) to be associated with the navigation entry | +| `to` | `string` | 要设置的地址 | +| `data?` | [`HistoryState`](HistoryState.md) | 可选的 [HistoryState](HistoryState.md) 以关联该导航记录 | -#### Returns %{#Methods-replace-Returns}% +#### 返回值 %{#Methods-replace-Returns}% `void` diff --git a/packages/docs/zh/api/interfaces/RouterLinkProps.md b/packages/docs/zh/api/interfaces/RouterLinkProps.md index af43373d..ce13b367 100644 --- a/packages/docs/zh/api/interfaces/RouterLinkProps.md +++ b/packages/docs/zh/api/interfaces/RouterLinkProps.md @@ -2,31 +2,31 @@ editLink: false --- -[API Documentation](../index.md) / RouterLinkProps +[API 参考](../index.md) / RouterLinkProps -# Interface: RouterLinkProps +# 接口:RouterLinkProps -## Hierarchy %{#Hierarchy}% +## 继承关系 %{#Hierarchy}% - `RouterLinkOptions` ↳ **`RouterLinkProps`** -## Properties %{#Properties}% +## 属性 %{#Properties}% ### activeClass %{#Properties-activeClass}% -• `Optional` **activeClass**: `string` +• `可选` **activeClass**: `string` -Class to apply when the link is active +链接在匹配当前路由时被应用到 class。 ___ ### ariaCurrentValue %{#Properties-ariaCurrentValue}% -• `Optional` **ariaCurrentValue**: ``"location"`` \| ``"time"`` \| ``"page"`` \| ``"step"`` \| ``"date"`` \| ``"true"`` \| ``"false"`` +• `可选` **ariaCurrentValue**: ``"location"`` \| ``"time"`` \| ``"page"`` \| ``"step"`` \| ``"date"`` \| ``"true"`` \| ``"false"`` -Value passed to the attribute `aria-current` when the link is exact active. +链接在匹配当前路由时传入 `aria-current` attribute 的值。 **`Default Value`** @@ -36,28 +36,27 @@ ___ ### custom %{#Properties-custom}% -• `Optional` **custom**: `boolean` +• `可选` **custom**: `boolean` -Whether RouterLink should not wrap its content in an `a` tag. Useful when -using `v-slot` to create a custom RouterLink +RouterLink 是否应该将其内容包裹在一个 `a` 标签里。用于通过 `v-slot` 创建自定义 RouterLink。 ___ ### exactActiveClass %{#Properties-exactActiveClass}% -• `Optional` **exactActiveClass**: `string` +• `可选` **exactActiveClass**: `string` -Class to apply when the link is exact active +链接在严格匹配当前路由时被应用到 class。 ___ ### replace %{#Properties-replace}% -• `Optional` **replace**: `boolean` +• `可选` **replace**: `boolean` -Calls `router.replace` instead of `router.push`. +调用 `router.replace` 以替换 `router.push`。 -#### Inherited from %{#Properties-replace-Inherited-from}% +#### 继承自 %{#Properties-replace-Inherited-from}% RouterLinkOptions.replace @@ -67,8 +66,8 @@ ___ • **to**: [`RouteLocationRaw`](../index.md#routelocationraw) -Route Location the link should navigate to when clicked on. +当点击该链接时应该进入的路由地址。 -#### Inherited from %{#Properties-to-Inherited-from}% +#### 继承自 %{#Properties-to-Inherited-from}% RouterLinkOptions.to diff --git a/packages/docs/zh/api/interfaces/RouterOptions.md b/packages/docs/zh/api/interfaces/RouterOptions.md index 3a5b63b8..a713881a 100644 --- a/packages/docs/zh/api/interfaces/RouterOptions.md +++ b/packages/docs/zh/api/interfaces/RouterOptions.md @@ -2,7 +2,7 @@ editLink: false --- -[API Documentation](../index.md) / RouterOptions +[API 参考](../index.md) / RouterOptions # 接口:RouterOptions %{#interface-routeroptions}% diff --git a/packages/docs/zh/api/interfaces/RouterScrollBehavior.md b/packages/docs/zh/api/interfaces/RouterScrollBehavior.md index ee3c2aff..c0eb1742 100644 --- a/packages/docs/zh/api/interfaces/RouterScrollBehavior.md +++ b/packages/docs/zh/api/interfaces/RouterScrollBehavior.md @@ -2,24 +2,24 @@ editLink: false --- -[API Documentation](../index.md) / RouterScrollBehavior +[API 参考](../index.md) / RouterScrollBehavior -# Interface: RouterScrollBehavior +# 接口:RouterScrollBehavior -## Callable %{#Callable}% +## 可调用函数 %{#Callable}% ### RouterScrollBehavior %{#Callable-RouterScrollBehavior}% ▸ **RouterScrollBehavior**(`to`, `from`, `savedPosition`): `Awaitable`<``false`` \| `void` \| `ScrollPosition`\> -#### Parameters %{#Callable-RouterScrollBehavior-Parameters}% +#### 参数 %{#Callable-RouterScrollBehavior-Parameters}% -| Name | Type | Description | +| 名称 | 类型 | 描述 | | :------ | :------ | :------ | -| `to` | [`RouteLocationNormalized`](RouteLocationNormalized.md) | Route location where we are navigating to | -| `from` | [`RouteLocationNormalizedLoaded`](RouteLocationNormalizedLoaded.md) | Route location where we are navigating from | -| `savedPosition` | ``null`` \| `_ScrollPositionNormalized` | saved position if it exists, `null` otherwise | +| `to` | [`RouteLocationNormalized`](RouteLocationNormalized.md) | 我们要导航到的路由地址 | +| `from` | [`RouteLocationNormalizedLoaded`](RouteLocationNormalizedLoaded.md) | 我们要离开的路由地址 | +| `savedPosition` | ``null`` \| `_ScrollPositionNormalized` | 要保存的页面位置,如果不存在则是 `null` | -#### Returns %{#Callable-RouterScrollBehavior-Returns}% +#### 返回值 %{#Callable-RouterScrollBehavior-Returns}% `Awaitable`<``false`` \| `void` \| `ScrollPosition`\> diff --git a/packages/docs/zh/api/interfaces/RouterViewProps.md b/packages/docs/zh/api/interfaces/RouterViewProps.md index e5c8034a..aaeac2a4 100644 --- a/packages/docs/zh/api/interfaces/RouterViewProps.md +++ b/packages/docs/zh/api/interfaces/RouterViewProps.md @@ -2,18 +2,18 @@ editLink: false --- -[API Documentation](../index.md) / RouterViewProps +[API 参考](../index.md) / RouterViewProps -# Interface: RouterViewProps +# 接口:RouterViewProps -## Properties %{#Properties}% +## 属性 %{#Properties}% ### name %{#Properties-name}% -• `Optional` **name**: `string` +• `可选` **name**: `string` ___ ### route %{#Properties-route}% -• `Optional` **route**: [`RouteLocationNormalized`](RouteLocationNormalized.md) +• `可选` **route**: [`RouteLocationNormalized`](RouteLocationNormalized.md)