search
HomeWeChat AppletMini Program DevelopmentWhat are the ways to jump to mini program pages?

What are the ways to jump to mini program pages?

There are several ways to jump to the mini program page:

1. wx.navigateTo(OBJECT)

This is the most A common jumping method, its official explanation is: "Keep the current page and jump to a page in the application"

is similar to window.location.href=" "
in HTML eg:

wx.navigateTo({ url: 'test?id=1'})
The actual effect is as follows:

What are the ways to jump to mini program pages?

The upper left corner of the applet There is a return arrow in the corner, which can return to the previous page

You can also return to the original page through the method wx.navigateBack

2. wx.redirectTo(OBJECT)

Close the current page and jump to a page within the app.
Similar to window.open('the page you want to jump to');
eg:
wx.redirectTo({ url: 'test?id=1'})
Effect As follows:

What are the ways to jump to mini program pages?

There is no return arrow in the upper left corner, and you cannot return to the previous page

3. wx.switchTab(OBJECT)

Jump to the tabBar page and close all other non-tabBar pages
eg:
{ "tabBar": { "list": [{ "pagePath": "index", "text": "Homepage" },{ "pagePath": "other", "text": "other" }] } }
wx.switchTab({ url: '/index'})

What are the ways to jump to mini program pages?

##wx.navigateTo and wx.redirectTo do not allow jumping to the tabbar page. You can only use wx.switchTab to jump to the tabbar page

4. wx.reLaunch(OBJECT)

Close all pages and open a certain page in the application.

Like wx.redirectTo, there will be no return arrow in the upper left corner, but they are not exactly the same.


Here we should mention the getCurrentPages() method in the mini program


In wx.navigateTo, every time a new page is jumped, its original page will be added to the stack. By calling wx.navigateBack(OBJECT), you can return to the previous level or by getting the page saved in the stack. Multi-level pages;

wx.redirectTo method will not be added to the stack, but you can still return to the page in the previous stack through the wx.navigateBack(OBJECT) method

wx.reLaunch method The current stack will be cleared.

eg:

// 此处是A页面wx.navigateTo({  url: 'B?id=1'})// 此处是B页面wx.navigateTo({  url: 'C?id=1'})// 在C页面内 navigateBack,将返回b页面wx.navigateBack({  delta: 1})
// 此处是B页面
wx.redirectTo({
 url: 'C?id=1'
 })
 // 在C页面内 navigateBack,则会返回a页面 
wx.navigateBack({
 delta: 1
 })
// 此处是B页面
wx.reLaunch({
 url: 'C?id=1'
 })
 // 在C页面内 navigateBack,则无效

Related recommendations:

小program development tutorial

The above is the detailed content of What are the ways to jump to mini program pages?. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.