The life cycle of wechat applets is divided into three categories:

1. Component life cycle (5)

created // Execute when the component instance has just been created. Note that setData cannot be called at this time
attached // Executed when the component instance enters the page node tree
ready // Execute after component layout is complete
moved Execute when the component instance is moved to another location in the node tree
detached // Executed when the component instance is removed from the page node tree
Copy the code

2. Page life cycle (5)

onLoad // Listen for page loading
onShow // Listen to the page display
onReady // The first rendering of the listening page is complete
onHide // Lifecycle callbacks - listen for page hiding
onUnload // Listen to the page uninstall
Copy the code

3. Application life cycle

onLaunch // Listen for applet initialization.
onShow // Listen for applets to start or cut foreground.
onHide // listen to the applet cut background
Copy the code