1.

More often developers tend to use the letters “vm”. They use it as a variable name to declare the root Vue application instance. What do the letters refer to for this case?

Answer»

Finding an easier way of performing tasks is one of the major functions of developers. Finding ways of DECLARING instances in a more simple way has led to the use of the two letters ‘vm’ to declare variable instances. Every vue instance begins by creating a completely fresh Vue instance. This uses the vue function.  

Var vm = new Vue ( {  }) 

Above is an illustration of how instance declaration is done in Vue. To some extent, we can say that Vue instance declaration was inspired by the Model-View-View-Model (MVVM) pattern. vm SHORT form for ViewModel has earned the status of conventional instance declaration in vue. Many vue applications have root Vue instances embedded with new Vue are organized into NESTED trees with reusable mechanisms.

Naming an instance as vm is not compulsory, ALTHOUGH many developers use it this way. As long as a compiler is able to compile successfully with minimal ERRORS and produce an output on the template, any naming can be used so long as it is easy and simple to understand.   



Discussion

No Comment Found

Related InterviewSolutions