Home >WeChat Applet >Mini Program Development >Page routing for mini program development

Page routing for mini program development

Y2J
Y2JOriginal
2017-05-18 13:33:172209browse

Page routing

The routing of all pages in the mini program is managed by the framework.

Page stack

The framework maintains all current pages in the form of a stack. When a routing switch occurs, the page stack behaves as follows:

Page routing for mini program development

getCurrentPages()

getCurrentPages() Function is used to obtain the instance of the current page stack, which is given in the order of the stack in the form of array. The first element is the homepage and the last element is the current page.

Tip: Do not try to modify the page stack, which will cause routing and page status errors.

Routing method

For routing triggering method and pageLife cycleThe functions are as follows:

Page routing for mini program development

Tab switching corresponding life cycle (take pages A and B as Tabbar pages, C is the page opened from page A, and page D is the page opened from page C):

Page routing for mini program development

Tips:

navigateTo, redirectTo can only open non-tabBar pages.

switchTab Only the tabBar page can be opened.

reLaunch You can open any page.

The tabBar at the bottom of the page is determined by the page, that is, as long as the page is defined as tabBar, there will be a tabBar at the bottom.

The parameters of the calling page routing can be obtained in onLoad of the target page.

【Related recommendations】

1. Complete source code download of WeChat mini program

2. Chaige WeChat mini program application store source code

3. Simple left swipe operation and waterfall flow layout

The above is the detailed content of Page routing for mini program development. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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