You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugins/router/navigation.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,41 @@ Router.navigate({
96
96
97
97
This results in: `#player/12/44`
98
98
99
+
## Optional router path
100
+
101
+
You can also specify the optional router path parameter to the Router path.
102
+
This is an advantage as we need not specify two different routes to the same component, instead we can specify optional field in router path with a '?' suffix for the optional params.
103
+
104
+
```js
105
+
{
106
+
path:'player/:assetId/:playlistId?',
107
+
component: Player
108
+
name:'player'
109
+
}
110
+
```
111
+
112
+
This will generate two paths as below:
113
+
114
+
```js
115
+
{
116
+
path:'player/:assetId/:playlistId'
117
+
component: Player
118
+
name:'player'
119
+
}
120
+
```
121
+
```js
122
+
{
123
+
path:'player/:assetId/',
124
+
component: Player,
125
+
name:'player'
126
+
}
127
+
```
128
+
129
+
Note: This will not work if the optional parameter ? is in the middle of the path. For Ex :
0 commit comments