Home > Web Front-end > JS Tutorial > body text

How to operate the vue function calling sequence

php中世界最好的语言
Release: 2018-05-10 13:57:22
Original
3786 people have browsed it

This time I will show you how to operate the vue function calling sequence and what are the precautions for operating the vue function calling sequence. The following is a practical case, let's take a look.

created and ready are both vue componentsLife cycle

created

Type: Function

Details:

Called synchronously after the instance is created. At this point the instance has finished parsing options, which means that: data binding, computed properties, methods, watcher/eventscallbacks have been established. But DOM compilation has not started yet, $el does not exist yet.

ready

Type: Function

Details:

Compiling End and el are called after the first insertion of the document, such as after the first attached hook. Note that it must be triggered by Vue insertion (for example, it is called after vm.el inserts the document for the first time, such as after the first attached hook. Note that it must be triggered by Vue insertion (for example, vm.appendTo() and other methods or instructions update)) ready hook.

compted is a calculated attribute, such as

computed:{ 
b:function(){ 
return this.a+1 
} 
}
Copy after login

Then the value of b is hooked to a, which is always equal to the value of a 1, and the value of a is modified. Sometimes it will change

vue’s ajax library recommends using vue-resource. Generally, non-single-page applications can obtain data in ready. If it is a single-page application, it is based on routingLifecycle to obtain, such as

route: { 
data: function (transition) { 
//数据获取,修改data 
transition.next() 
} 
}
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Summary of js data parsing skills

Tips for using DOM event binding in js

The above is the detailed content of How to operate the vue function calling sequence. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template