Skip to content
Merged
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: 1 addition & 3 deletions packages/docs/guide/essentials/redirect-and-alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ const routes = [
path: '/users/:id/posts',
redirect: to => {
// the function receives the target route as the argument
// a relative location doesn't start with `/`
// or { path: 'profile'}
return 'profile'
return to.path.replace(/posts$/, 'profile')
},
},
]
Expand Down
4 changes: 1 addition & 3 deletions packages/docs/zh/guide/essentials/redirect-and-alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ const routes = [
path: '/users/:id/posts',
redirect: to => {
// 该函数接收目标路由作为参数
// 相对位置不以`/`开头
// 或 { path: 'profile'}
return 'profile'
return to.path.replace(/posts$/, 'profile')
},
},
]
Expand Down