Home >WeChat Applet >Mini Program Development >How to jump to the mini program development page?

How to jump to the mini program development page?

青灯夜游
青灯夜游forward
2020-04-29 17:10:012798browse

How to jump to the mini program development page?

In previous APP or web products, users can browse multiple pages when using them, and the servers of these products can carry enough data. The characteristic of mini programs is their small size. In order to avoid causing trouble to users when using mini programs, WeChat mini programs stipulate that the page path can only be five levels. Please try to avoid multi-level interactions.

Page jump involves multiple page levels

The first one: wx.navigateTo(OBJECT)

Keep the current page, jump to a page in the application, and use wx.navigateBack to return to the original page.

OBJECT parameter description:

url String The path of the page within the application that needs to be jumped. Parameters can be included after the path. Parameters and paths are separated by ?, parameter keys and parameter values ​​are connected by =, and different parameters are separated by &; for example, 'path?key=value&key2=value2'

success Function interface calls the callback function successfully

fail Function The callback function that fails to call the interface

complete Function The callback function that ends the interface call (will be executed if the call is successful or failed)

onLoad:function(options) {
wx.navigateTo({
url:\'../index/index\' })}

Second type: wx. redirectTo(OBJECT)

Close the current page and jump to a page within the application.

OBJECT parameter description:

url String The path to the page within the application that needs to be jumped

success Function The callback function for successful interface calls

fail Function interface Callback function that fails to call

complete Function Callback function that ends the interface call (will be executed if the call is successful or failed)

onLoad:function(options) {
 wx.redirectTo({
url:\'../index/index\' }) }

Third type: wx.navigateBack(OBJECT)

Close the current page and return to the previous page or multi-level page. You can get the current page stack through getCurrentPages()) to determine how many levels need to be returned.

OBJECT parameter description:

delta Number The number of pages returned. If delta is greater than the existing number of pages, return to the homepage.

onLoad:function(options) {
var pages =getCurrentPages()
var num =pages.length
navigateBack:function(){
 wx.navigateBack({
 delta: num
})}}

Recommended: "小program development tutorial"

The above is the detailed content of How to jump to the mini program development page?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete