#vue# Lifecycle

Three stages: creation stage --- operation stage --- destruction stage

1. Creation stage

(1)beforeCreate

(2) created (commonly used in actual projects): the props/data/methods of the component have been created, and when entering this page, the component can call the method and get the data

(3)beforeMount

(4) mounted (commonly used in actual projects): the html in the memory has been rendered into the browser, and the DOM structure can be manipulated

2. Operation stage

(1)beforeUpdate

(2) updated (commonly used in actual projects): when the data changes, in order to operate the latest DOM structure, the code needs to be written here

3. Destruction stage

(1)beforeDestroy

(2) destroyed (commonly used in actual projects): destroy components and remove DOM structure

Guess you like

Origin blog.csdn.net/ZHENGCHUNJUN/article/details/127253117