


Abstract: In the development process of WeChat applet, we will definitely encounter the need to jump between pages, so how to monitor the events between page jumps? In our previous article: Research on eLong WeChat Mini Program Framework Components (with source code) as an example, let’s take a look at the events when the mini program jumps between pages...
In the development process of WeChat applet, we will definitely encounter the need to jump between pages. So how to monitor the events between page jumps? We took a previous article: Research on Framework Components of Yilong WeChat Mini Program (source code attached) as an example to take a look at the event mechanism when mini programs jump between pages. We know that the mini program provides four mechanisms to change the view, including opening a new page, page redirection, page return, and tabBar switching. It hosts the page. life cycle, and provides corresponding life cycle events for the application to facilitate business processing at each stage of the application, but there is no corresponding event mechanism for jumping between pages, for example -
The above two scenarios are very common and boil down to page How to interact conveniently? Of course, we can achieve the goal by passing parameters or global data objects through page jumps, but there are some restrictions on use (converting parameters or maintaining global objects)! So the event mechanism is used to solve this problem in the elong applet project . We rewrote navigateToAPI. After page A calls this interface to jump to the page, the method returns an event object event to page A. This object can register custom events, and the target page (page B) can follow the business The demand triggers the event response, and the relevant data is passed as a parameter to the listening callback.
##API
##Event
|
The above is the detailed content of How to monitor events when jumping between WeChat applet pages. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools