What is the life cycle in vue
This article is about what the life cycle is in vue. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
What is the life cycle
Each component may go through the process of creating, mounting, updating, and uninstalling.
At some point in the process, you may want to add some logic code of your own (for example, request some server data after the component has been created)
But how do we know which process the component is currently in? vue provides us with the lifecycle function of the component.
Second, life cycle function
The lifecycle function is a hook function that is called back by vue internal source code at a certain time.
By callback to the lifecycle function, we know what phase the component is going through right now.
Then we can write our own logic code in this declaration cycle.
III. The process of life cycle
4. Simple life cycle code
When you use keep-alive for a package component, you can print out the result as follows:
Thank you for reading!