Today, record the app lifecycle of WeChat applets and the life cycle of each page.
in app.json, three methods
1OnLauch method only starts at the small program Touch once.
2onshow method, when the applet is started, and the background is switched to the front desk display.
3onHide method, trigger when the small program is displayed by the front desk to the background.
You can feel each life cycle by ↓ this picture.
More interesting place is that the small program will trigger twice onShow when startup, I don’t know why. Classmates who want to know will explain. (2) The life cycle of the page
1. I added two ways to jump to the new CRAB page in Index ↓ here brief introduction
1 In the index.wxml file, you will be jumped by adding a URL to the
2 to bind the button to Index.js, and I will name the method to TurncrabFunction. This method is implemented in Index.js.
2. The following introduces each life cycle in crab.js
↓ 图 为 This file part code, prints with console.log, so that we can observe each life cycle. (Note in each function, the corresponding function description.)
, OnsomeFunction is my casual name, and other methods have fixed names and meanings.
3. In the INDEX interface, we choose any kindThe way enters the CRAB interface.
(If you do not implement the new brush, check the WINDOW parameters in app.json, or check the current page of Crab.json Whether the file covers this parameter false)
If you have any questions, please leave a message or to this site community communication, thank you, I hope to help everyone, thank you Support for this site!