How to monitor the return button of the mini program

angryTom
Release: 2020-03-13 15:11:00
Original
5050 people have browsed it

How to monitor the return button of the mini program

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

How to monitor the return button of the mini program

#2. Register the onUnload event on the details page and listen for the page to be unloaded.

How to monitor the return button of the mini program

3. Click the return button at the top. Effect:

How to monitor the return button of the mini program

## Recommended learning:

小program development

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!