Skip to content

Commit 65f9fd1

Browse files
authored
docs(updating): add vue router 5 migration guidance for ionic 9 (#4491)
* docs(updating): add vue router 5 migration guidance for ionic 9 * docs(support): add v9 vue support and vue router version table
1 parent 1ab61c6 commit 65f9fd1

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

docs/reference/support.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,22 @@ Note that later versions of Ionic do not support iOS 13; see [mobile support tab
7676

7777
| Framework | Required Vue Version | TypeScript |
7878
| :-------: | :------------------: | :--------: |
79+
| v9 | v3.5+ | 3.9+ |
7980
| v8 | v3.0.6+ | 3.9+ |
8081
| v7 | v3.0.6+ | 3.9+ |
8182
| v6 | v3.0.6+ | 3.9+ |
8283
| v5 | v3.0+ | 3.9+ |
8384

85+
#### Ionic Vue Router
86+
87+
| Framework | Required Vue Router Version |
88+
| :-------: | :-------------------------: |
89+
| v9 | v5+ |
90+
| v8 | v4+ |
91+
| v7 | v4+ |
92+
| v6 | v4+ |
93+
| v5 | v4+ |
94+
8495
### Native Bridges
8596

8697
| Framework | Cordova | Capacitor |

docs/updating/9-0.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ For more information on migrating from React Router v5 to v6, refer to the [Reac
238238

239239
### Vue
240240

241-
1. Ionic 9 supports Vue 3.0.6+. Update to the latest version of Vue:
241+
1. Ionic 9 supports Vue 3.5+ and Vue Router 5. Update Vue and Vue Router:
242242

243243
```shell
244244
npm install vue@latest vue-router@latest
@@ -250,6 +250,48 @@ npm install vue@latest vue-router@latest
250250
npm install @ionic/vue@latest @ionic/vue-router@latest
251251
```
252252

253+
#### Vue Router 5 Migration
254+
255+
`@ionic/vue-router` now requires Vue Router v5. Vue Router v4 is no longer supported. Vue Router v5 also raises its peer requirement on Vue itself, so the minimum supported Vue version moves to `3.5.0`.
256+
257+
Vue Router v5 is a transition release that ships no runtime breaking changes for Vue Router v4 consumers, so no application code changes are required for routes, navigation guards, or `IonRouterOutlet`. Bump the dep ranges in your app's `package.json`:
258+
259+
```diff
260+
"dependencies": {
261+
- "vue": "^3.4.0",
262+
- "vue-router": "^4.0.0"
263+
+ "vue": "^3.5.0",
264+
+ "vue-router": "^5.0.0"
265+
}
266+
```
267+
268+
#### Deprecation Warning for `next()` in Navigation Guards
269+
270+
Vue Router v5 prints a deprecation warning when `next()` is called inside `beforeRouteLeave`, `beforeRouteEnter`, `beforeRouteUpdate`, or `router.beforeEach`. The callback form still works, but Vue Router v6 will remove it. Migrate to the return-value pattern:
271+
272+
```diff
273+
// Composition API
274+
onBeforeRouteLeave((to, from) => {
275+
- if (!confirm('Leave?')) return next(false);
276+
- next();
277+
+ if (!confirm('Leave?')) return false;
278+
+ return true;
279+
});
280+
```
281+
282+
```diff
283+
// Options API
284+
- beforeRouteLeave(to, from, next) {
285+
- if (!confirm('Leave?')) return next(false);
286+
- next();
287+
+ beforeRouteLeave(to, from) {
288+
+ if (!confirm('Leave?')) return false;
289+
+ return true;
290+
}
291+
```
292+
293+
For more information on migrating from Vue Router v4 to v5, refer to the [Vue Router v4-to-v5 migration guide](https://router.vuejs.org/guide/migration/v4-to-v5.html).
294+
253295
### Core
254296

255297
1. Update to the latest version of Ionic 9:

0 commit comments

Comments
 (0)