App Initialization
Explore how to initialize Vue applications using the createApp method in Vue 3, which allows multiple isolated Vue instances. Understand how plugin installation and global properties differ from Vue 2, enabling more modular and flexible application setups.
We'll cover the following...
Another change in the latest version of Vue is how a Vue application is initialized. Previously, new Vue() was used to create a new Vue application instance. However, it was impossible to create separate Vue applications in Vue 2 because they shared the same Vue context. Vue 3 doesn’t have a default export anymore, so a Vue application must be created using the createApp method. The createApp returns a new application instance, which provides an isolated Vue context.
Note: References to Vue applications in this section, it doesn’t mean two separate Vue projects but, rather, one project with two Vue application instances that were created using the
createAppmethod.
Vue 2 and Vue 3
See how ...