Ionic Vue Enables Developers to Write Cross-Platform Mobile Applications with Vue 3

Liam de Beasi recently released Ionic Vue, a native Vue version of the Ionic Framework that leverages Vue 3’s new features. Following Ionic React released last year, Ionic Vue is a step forward in the realization of the vision promoted with the web-components-based Ionic 4 (code-named Ionic for Everyone).

De Beasi summarized how Ionic Vue fits into the Ionic team vision as follows:

The release of Ionic Vue demonstrates that any web developer can build performant, cross-platform applications with Ionic Framework using the framework of their choice.

Ionic Vue builds on Vue’s official router (vue-router) and extends it with a few custom APIs. The resulting package (@ionic/vue-router) can be used as follows:

import { createRouter, createWebHistory } from '@ionic/vue-router'; import Home from '@/views/Home.vue' const router = createRouter({    history: createWebHistory(process.env.BASE_URL),    routes: [ {        path: '/',        redirect: '/home' }, {        path: '/home',        name: 'Home',        component: Home      }, {        path: '/lazy',        component: () => import('@/views/Lazy.vue') } ] }) 

The release note lists additional differences to be aware of when using Ionic Vue. Developers must wrap an Ionic page into a <ion-page> component for transitions and lifecycle events to work as expected. Developers may use Ionic-specific lifecycle events (e.g. ionViewDidEnter, ionViewDidLeave). @ionic/vue supports every Ionic Framework component except ion-virtual-scroll.

De Beasi summarized the next steps for Ionic Vue as follows:

What’s next? We will be providing improved Vetur/Intellisense support very soon. Additionally, we are working on providing full Server-Side Rendering (SSR) support. Keep an eye out for an Ionic Vue SSR blog for how you can help test that!

Developers can get started with Ionic Vue by installing and using the Ionic CLI to create an Ionic Vue starter application:

npm install -g @ionic/cli@latest  ionic start my-vue-app --type vue  

Developers may use JavaScript or TypeScript to write an Ionic Vue application. Using JavaScript will however require manually modifying the application template generated by the command-line interface.

Developers may develop native mobile applications by using Ionic Vue together with Capacitor. The release note provides an example of using two Capacitor APIs (Camera and Filesystem).

The Ionic Framework is an open-source UI toolkit that helps developers build high-quality mobile apps for native iOS, native Android, and the web. The Ionic Framework is open-source software available under the MIT license. Contributions and feedback are encouraged via the Ionic GitHub project and should follow the Ionic contribution guidelines and code of conduct.