Vue (pronounced view) is a progressive framework for building user interfaces. Vue allows you to build applications using the MVVM (Model-View-ViewModel) architectural pattern.
Pros of Vue.js:
- fast enough development;
- lightweight framework;
- good documentation;
- large developer community;
- fast interaction with virtual DOM;
- connecting plugins and creating your own plugins;
- component application development;
- implements modern approaches to development;
- support for server-side rendering of the application with Nuxt.js.
This framework uses ideas – reactive programming. Reactive programming is when development is based on streams of static and dynamic data, and propagation of changes thanks to the stream of this data.
All Vue components are also Vue instances and therefore also accept a parameters object.
Components are the separation of code, its encapsulation, into independent parts that allow code reuse. The components form a tree-like hierarchy.
Dividing the program code into some separate components, which then interact with each other, is a good solution when building high-quality applications. These applications are easier to maintain because the code for each component is written so that there are as few dependencies as possible between the components. After all, when the first code depends on the second, and in this second, something has changed, then we can expect that in the first code something will go wrong as expected.
Vue.js allows you to split all application code into components and even load the required component asynchronously at the right time.
There are 3 types of application code splitting:
- separation out of sight;
- conditional split.
1. Paging code splitting
Splitting code page by page is done when the application uses multiple pages, that is, your application is not a single page application. A separate component is responsible for each page, and files with these components are assembled through the import function. When moving between pages, the required files will be loaded asynchronously. This behavior can be done with Vue.js routing. More information is here About Fireart.
2. Splitting code out of sight
The separation of the application code out of visibility is when there is some part that needs to be displayed only at the moment when the other part is outside the displayed, that is, currently visible, part of the application. For example, your application displayed 5 posts on the screen, when you scroll a little lower, the application loads 5 more posts asynchronously, and so on. This is a very necessary thing that allows you to save application resources, making it more productive at work.
3. Splitting code by condition
When some part of the application should be displayed depending on the state of an element or the execution of an action, then you can use the code splitting by condition. For example, if a user is in one group, then one type of content can be uploaded to him, if the user is in the second group, then a different type of content is displayed to him, and so on. This also includes any pop-up windows, tabs, displaying items depending on the state of various switches.