Analysis of JS front-end development and MVVM selection

Source: Internet
Author: User

Recently finally made up his mind to learn something at the front, but the various frameworks, dazzling.

First summarize the history of JS front-end

1. Slash and burn, primitive times

This time using the DOM native API to work with HTML elements, estimating functions such as Getelementby

2. Steam engine, Industrial age

such as jquery and other frameworks appear, DOM operations are encapsulated in the framework, can be easily updated

3, electricity, post-industrial era

React, Vue, angular, Avalon and other mvvm, forget to manipulate DOM

Speaking of MVVM actually variable binding, the DOM and JS variable binding, update JS variable can be achieved to update the DOM, or two-way binding.

First look at the foreign angular2 and react, feel too large, so the main focus on the Vue and Avalon, the following is the binding syntax of the two.

Avalon's binding syntax

<script>
var vm = Avalon.define ({
$id: "Test",
a:111
})
</script>

<div ms-controller= "Test" >
{{@a}}
</div>

Vue's binding syntax

<id= "app">  {{message}}</Div > <script>new Vue ({  el: ' #app ',  data: {    message: ' Hello vue.js! '  }})
</script>

Can be seen almost the same, and Avalon is bound to use extra tags when the output is more a @,vue code is significantly more concise.

And the two methods of binding are almost all implemented with Object.defineproperties. Both of the 1.x versions did not include virtual DOM, and the virtual Dom was used after 2.0.

I hesitated for a long time on which to use. Avalon has a performance comparison on the Web, and in the 1.x era, it has a higher performance than Vue.

Because I do not see the source code, I think the performance gap may come from the binding syntax, Vue does not require additional tags, then some of the DOM is bound, some are not bound, scanning

The analysis must be slower than the tagged Avalon.

In addition, due to the richer components of Avalon, the supported browsers are as low as the amazing IE6, so the final choice is Avalon.

Removing virtual DOM We can actually implement a simple MVVM, such as a jquery wrapper, and a variable bound syntax sugar.

Perhaps you can also use the element and line number hash table to correspond, directly with the regular expression.

Analysis of JS front-end development and MVVM selection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.