Skip to content

Commit 3288f94

Browse files
committed
docs: add tip for omitting component option since release of v4.1.0
1 parent f45ed57 commit 3288f94

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/docs/guide/essentials/redirect-and-alias.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Note that **[Navigation Guards](../advanced/navigation-guards.md) are not applie
4343

4444
When writing a `redirect`, you can omit the `component` option because it is never directly reached so there is no component to render. The only exception are [nested routes](./nested-routes.md): if a route record has `children` and a `redirect` property, it should also have a `component` property.
4545

46+
::: tip Tip
47+
Since release of [4.1.0](https://github.com/vuejs/router/releases/tag/v4.1.0),it's possible to completely omit the component option when defining routes with children.
48+
:::
49+
4650
### Relative redirecting
4751

4852
It's also possible to redirect to a relative location:

packages/docs/zh/guide/essentials/redirect-and-alias.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ const routes = [
4343

4444
在写 `redirect` 的时候,可以省略 `component` 配置,因为它从来没有被直接访问过,所以没有组件要渲染。唯一的例外是[嵌套路由](./nested-routes.md):如果一个路由记录有 `children``redirect` 属性,它也应该有 `component` 属性。
4545

46+
::: tip 更新
47+
[4.1.0](https://github.com/vuejs/router/releases/tag/v4.1.0) 的版本更新之后,你完全可以忽略嵌套路由的 `component` 属性。
48+
:::
49+
4650
### 相对重定向
4751

4852
也可以重定向到相对位置:

0 commit comments

Comments
 (0)