SoFunction
Updated on 2025-04-07

Introduction to the order of calls to functions in vue

method is used to define a method. For example, if you @click=”test”, methods define the method test.

Created and ready are both the life cycle of vue components

created

Type: Function

detailed:

Synchronous calls are called after instance creation. At this time the instance has ended the parsing option, which means: data binding, computed properties, methods, watcher/event callback has been established. But DOM compilation has not started yet, $el does not exist.

ready

Type: Function

detailed:

Called after the compilation ends and el is inserted for the first time, as after the first attached hook. Note that it must be inserted by Vue (such as after the first insertion of the document, such as after the first attached hook. Note that it must be inserted by Vue (such as methods or instructions such as () or updates) to trigger the ready hook.

Compted is a computed property, for example

computed:{ 
b:function(){ 
return +1 
} 
} 

Then the value of b is hooked to a, always equal to the value of a +1, and it will also change when modifying the value of a.

vue's ajax library is recommended to use vue-resource. Generally, non-single-page applications can obtain data in ready. If it is a single-page application, it is obtained based on the routing life cycle, for example

route: { 
data: function (transition) { 
//Data acquisition, modify data() 
} 
}

The above introduction to the order of calling functions in vue is all the content I have shared with you. I hope you can give you a reference and I hope you can support me more.