Skip to content
Closed
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
13 changes: 13 additions & 0 deletions docs/guide/essentials/dynamic-matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ const User = {

You can check out a live example [here](https://jsfiddle.net/yyx990803/4xfa2f19/).


You can make a parameter optional by adding `?` to the end of the parameter.

```js
const router = new VueRouter({
routes: [
//
{ path: '/user/:id?', component: Users }
]
})
```


You can have multiple dynamic segments in the same route, and they will map to corresponding fields on `$route.params`. Examples:

| pattern | matched path | \$route.params |
Expand Down