Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of Life cycle process in Vue

Shulou Source: shulou.com Published: 2022-06-03 14:01:46 11月11日 Update

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!

Tags: Cycle function life process structure state hook example analysis content periodic function property method article that is value function interest example boy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Apple Microsoft Shulou Tech Info Redmi