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: README.md
+17-6Lines changed: 17 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Check the [playground](https://github.com/vuejs/vue-router-next/tree/master/play
26
26
27
27
-`base` option is now passed as the first argument to `createWebHistory` (and other histories)
28
28
- Catch all routes (`/*`) must now be defined using a parameter with a custom regex: `/:catchAll(.*)`
29
-
-`router.match` and `router.resolve` are merged together into `router.resolve` with a slightly different signature
29
+
-`router.match` and `router.resolve` are merged together into `router.resolve` with a slightly different signature. Check it's typing through autocomplete or [Router's `resolve` method](https://github.com/vuejs/vue-router-next/blob/master/src/router.ts)
30
30
-`router.getMatchedComponents` is now removed as they can be retrieved from `router.currentRoute.value.matched`:
31
31
```js
32
32
router.currentRoute.value.matched
@@ -42,9 +42,10 @@ Check the [playground](https://github.com/vuejs/vue-router-next/tree/master/play
42
42
Otherwise there will be an initial transition as if you provided the `appear` prop to `transition` because the router displays its initial ___location (nothing) and then displays the first ___location. This happens because navigations are all asynchronous now. **If you have navigation guards upon the initial navigation**, you might not want to block the app render until they are resolved.
43
43
- On SSR, you need to manually pass the appropriate history by using a ternary:
44
44
```js
45
+
// router.js
45
46
let history = isServer ?createMemoryHistory() :createWebHistory()
46
47
let router =createRouter({ routes, history })
47
-
//on server only
48
+
//somewhere in your server-entry.js
48
49
router.push(req.url) // request url
49
50
router.isReady().then(() => {
50
51
// resolve the request
@@ -54,7 +55,7 @@ Check the [playground](https://github.com/vuejs/vue-router-next/tree/master/play
54
55
55
56
### Typings
56
57
57
-
To make typings more consistent and expressive, some types have been renamed. Keep in mind these can change until stable release to ensure consistency. Some types might have changed as well.
58
+
To make typings more consistent and expressive, some types have been renamed. Keep in mind these can change until stable release to ensure consistency. Some type properties might have changed as well.
58
59
59
60
|`vue-router@3`|`vue-router@4`|
60
61
| -------------- | ----------------------- |
@@ -71,7 +72,7 @@ These are technically breaking changes but they fix an inconsistent behavior.
71
72
- Empty children `path` does not append a trailing slash (`/`) anymore to make it consistent across all routes:
72
73
- By default no route has a trailing slash but also works with a trailing slash
73
74
- Adding `strict: true` to a route record or to the router options (alongside `routes`) will disallow an optional trailing slash
74
-
- Combining the point above with a trailing slash in your routes allows you to enforce a trailing slash in your routes. In the case of nested routes, make sure to add the trailing slash to the parent:
75
+
- Combining `strict: true`with a trailing slash in your routes allows you to enforce a trailing slash in your routes. In the case of nested routes, make sure to add the trailing slash to the parent**and not the empty child**:
75
76
```js
76
77
let routes = [
77
78
{
@@ -80,14 +81,24 @@ These are technically breaking changes but they fix an inconsistent behavior.
80
81
},
81
82
]
82
83
```
83
-
- To redirect the user to trailing slash routes (or the opposite), you can setup a `beforeEach` navigation guard that ensures the presence of a trailing slash
84
+
- To redirect the user to trailing slash routes (or the opposite), you can setup a `beforeEach` navigation guard that ensures the presence of a trailing slash:
0 commit comments