Good programmers web front-end share MVVM framework implementation principle Vue

  Good programmers web front-end share Vue MVVM framework implementation principle, Vue.js the moment is very fire a JavaScript MVVM library, which is based on data-driven ideas and component-based construction. Compared to Angular.js and react.js more concise, easier to understand the API, so that we can quickly get started and use Vue.js.


1. What is MVVM it?

MVVM is short for Model-View-ViewModel.

  In the past 10 years there, we've put a lot of traditional server-side code into a browser, thus creating thousands of lines of javascript code that connects HTML and CSS files, but the lack of a formal organization, this is why many developers use the framework. For example: angular.js, react.js, vue.js. With After these frameworks, browser compatibility issues no longer prevent us from front-end development. (There should be cheers, did you say that, next time you write tell-browser compatible) project continued in front of the volume increase, from a humble little page becomes a colorful thousands of pages required tens of thousands of code, which leads to the maintainability and scalability become the most important projects include issues important to security.

  This is why there are a lot of developers use the framework, the framework is simple, there are API. In the year that time in order to resolve browser compatibility issues, there have been many libraries, the most typical is JQuery. But this type of library does not implement into the business logic, so poor maintainability and scalability. In summary two reasons, only the emergence of a class of MVVM pattern framework. For example vue.js framework is through the two-way data binding, which greatly improved the efficiency of development.

  1. MVVM framework

Vue MVVM pattern is based on a framework to achieve, in the framework vue:

Model: refers to the data js, such as objects, and the like array.

View: refers to the page view

viewModel: vue refers to instantiating the object,

  He said Vue.js is a progressive javascript framework, incremental What does it mean?

  1.   If you already have an existing application server, you can vue as part of the application to join, bring better interactive experience;

  2.   If you want to put more business logic interface is implemented, then the Vue meet most of your needs, (vue2.x + vue-router + axios + webpack). Like other front-end frame, the advantage is that the VUE every function well, the effects of the components into, a better maintainability can also be multiplexed, each component comprising their own HTML, CSS, JAVASCRIPT to be used to render web pages in the appropriate place

  3. If we build a large application, at this point, vue there is a command-line tool that enables fast initialization a real project becomes very simple (vue init webpack my-project). We can use the VUE single file component that contains their own html, JavaScript and css with scope or scss.

These three examples above, is a progressive step by step, that the use of Vue.js large or small, it will have the appropriate way to integrate into your project. So it is a progressive framework. Vue.js most unique features: When our data changes, Vue.js will help you update all the pages where it is used.


Guess you like

Origin blog.51cto.com/14249543/2403268