Home > Article > Web Front-end > How to operate the vue function calling sequence
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 } }
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() } }
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!