The difference between WeChat applet onLoad and onShow

What is the difference between onLoad and onShow for applet life cycle?

OnLoad is called when the page is loaded, and parameters can be obtained through options.

Called when the onShow page is displayed.

 

The main difference:

When returning to the page from the secondary page, onLoad will not load again, but onshow will reload.

This is very important:

1. If the list page is loaded, and the content of the first-level list page is modified on the second-level page, and the list function should be loaded in onShow, otherwise you can select onLoad.

2. If you jump from one page with parameters to another page, the way to get the parameters on another page: onLoad(options){ console.log(options.xxx) }, these parameters are all hung in the options.

 

Reprinted from: https://www.cnblogs.com/helena000/p/11213466.html

Guess you like

Origin blog.csdn.net/z3287852/article/details/112980908