How to monitor the return button of the mini program
The system's return buttoncannot be monitored.
Change your thinking? Since you need to monitor the return key, the system does not provide an implementation. Hack it yourself
1. If you return, the original page will use the onUnload function. You can perform similar processing in this onUnload function
2. The system provides the function getCurrentPages. Based on the number of pages or pageId, the returned page is processed by itself onShow.
Let’s introduce the first implementation method:
1. In the index page, add a method to the button to jump to the details page, as shown in the figure below
#2. Register the onUnload event on the details page and listen for the page to be unloaded.
3. Click the return button at the top. Effect:
## Recommended learning:The above is the detailed content of How to monitor the return button of the mini program. For more information, please follow other related articles on the PHP Chinese website!