Skip to content

docs: add tip for omitting component option since release of v4.1.0 #1810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/docs/guide/essentials/redirect-and-alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Note that **[Navigation Guards](../advanced/navigation-guards.md) are not applie

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.

::: tip Tip
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.
:::

### Relative redirecting

It's also possible to redirect to a relative location:
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/zh/guide/essentials/redirect-and-alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const routes = [

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

::: tip 更新
在 [4.1.0](https://github.com/vuejs/router/releases/tag/v4.1.0) 的版本更新之后,即使一个路由记录有 `children` ,你也完全可以忽略它的 `component` 属性。
:::

### 相对重定向

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