Example Analysis of Life cycle process in Vue
This article mainly introduces the example analysis of the life cycle process in Vue, which is very detailed and has a certain reference value. Friends who are interested must finish it!
Vue provides 11 hook functions
1. What is the period of a series of states from creation to destruction? in this process, vue will provide a state function for us to perform.
The operation of this state, this function is called hook function / life cycle function / life cycle hook
Process:
New Vue ({})
Vue instance initialization, read all lifecycle functions, is not executed, will not be called
BeforeCreate ()
Read properties, calculate properties, add listening set get methods, read watch methods
Create () can manipulate the data.
Determine whether there is an el configuration, or whether $mount () is called, will take the next step.
Determine whether there is a dom structure with the function of el or $mount ()
BeforeMount has no dom structure.
If there is a dom structure, read the dom structure rendering vue instruction {{}}, that is, the mount process
Mounted () can operate on ref
Here you can use ref to operate dom, the usage is ref= "id", this.$refs, where id is a unique value, handwritten id will overwrite, but use v-for to traverse ref,id into an array, will not overwrite.
The above is all the content of the article "sample Analysis of Life cycle processes in Vue". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!