Vue Base Vue Instance

Source: Internet
Author: User
Tags constructor
Constructor:

Each Vue.js application is started by using the constructor Vue to create a Vue root instance:

When you instantiate Vue, you need to pass in an option object that can contain options such as data, templates, Mount elements, methods, life cycle hooks, and so forth.

You can extend the Vue constructor function by extending the option to create a reusable component constructor with the extended options that we specify to pass in:

All "Mycomponentinstance" objects are properties and methods that are created through the pre-passed extension options :

Each Vue instance proxies all the attributes in its data object:

In addition to the Data property, the Vue instance has its own instance properties and methods, which are prefixed with $ to differentiate the instance lifecycle from the proxy's Data property:

Each Vue instance undergoes a series of initialization processes before it is created. For example, an instance needs to configure data observer, compile a template, mount an instance to the DOM, and then update the DOM when the data changes. In this process, the instance also invokes some lifecycle hooks, which gives us the opportunity to execute the custom logic

For example, created this hook is called the life cycle diagram After the instance is created:

The following figure illustrates the life cycle of an instance. You don't need to know everything right away, but it will help later.

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.