Written before the small application project recently, no use for a long time, some strange, for a small application life cycle also forgotten about, then open the official documentation, check, see this part onLoad and onShow, for the description of the website is not very understand, and seek help from baidu, search a wave, you explain about ah, a few look down, I still don’t understand what onLoad() should be called the first time the page is displayed. So, decided to hands-on, practice a (after all, practice is the real knowledge, ha ha 😏), say we come, first find two pages, onLoad and onShow interrupt point, see how the operation process is? The steps are as follows:
1. Click on the red box to enter details page (details page below). Breakpoints in onLoad and onShow hook function of details page are executed.
2. Click the red box of the details page to enter the comment page, where the breakpoints in the onLoad and onShow lifecycle hook functions are executed.
3. Click the return arrow of the comment page to return to the details page. At this time, the breakpoint in onShow of the details page is triggered. Continue to return to the home page from the details page, and click the part in the red box in figure 1 again to enter the details page. At this time, breakpoints in the onLoad and onShow hook functions of the details page will be triggered.
At this point, the validation process is complete.
After this operation, I understand that in simple terms: when jumping from page A to page B, onLoad and onShow of page B will be loaded; when jumping from page B to page C and then from page C to page B, only onShow of page B will be loaded, but onLoad will not be loaded.