Overview VUE2.0 A lot of changes _javascript skills not to be overlooked

Source: Internet
Author: User

Today, using Webpack-sample to start a VUE-CLI project, In the App.vue file added a hook function ready, but ready within the event has not been carried out, check webpack files and Package.json did not find any problems, the browser also did not complain or hint, it is very urgent to catch. Then go to GitHub see Webpack-simple Source code, only to find the original VUE init webpack-simple default installed Vue is 2.0 version. Immediately speculated that it was because vue2.0 abandoned the use of ready, as expected, I was too witty. Read the English document of the next vue2.0, found that there are many changes relative to the vue1.0, and the change is not generally big .... If the project to upgrade to vue2.0, so many pages to be corrected, many components can not be used, so the current project can not be upgraded to death. You can install VUE-CLI based on the vue1.0 version through the Vue init webpack-simple#1.0.

Below to analyze several important vue2.0 with their current project related changes, purely personal understanding, right when understanding, detailed English document in this https://github.com/vuejs/vue/issues/2873

1. The current project uses 1.0 of the Ready hook function on almost every page, whereas 2.0 has been discarded and replaced with mounted, adding Beforemount, Beformount, BeforeUpdate, updated, etc. Private thought more and more to react on the same wood has.

2. Also obsolete events, $dispatch, $broadcast, the official recommended the use of Vuex or global event bus (the event bus is what, novice one, not very clear), but the abandoned methods in Vux Many parts of the UI framework are used, and it is no doubt that the place where it is used in the project will not work in the 2.0 version, and may even complain.

3.v-ref, V-el deprecated unify use the ref attribute to add a tag to an element or component, and then pass this. $refs get

For example <p ref= "A" ></p> get method for this. $refs. A is also true for custom components

4. $els is used to get the element Dom object, this is also discarded, $refs can play an alternative role.

$index, $key that are commonly used in 5.v-for loops are also not supported

6. Custom components in the partial, discard, this has been useless to

7. New v-once directive

8. New Propsdata

9. New Render

The above mentioned is a small set to introduce the VUE2.0 can not be overlooked a lot of changes, I hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.