Mini Program, from A to B, it is judged that there is no permission to jump to C, C, press return, how to jump to A?

A br B is the original bottom tab page
An is the home page B is the personal page C is the landing page
from A to B, B determines the login status in onShow, without permission wx.navgitorTo jumps to C, how can you jump to the home page if you don"t log in at this time? If the point returns in the upper left corner, it will jump back to B, and automatically jump back to C because it has no permission, which becomes an endless loop.

if you take a parameter, it is judged on the B page that it jumped back from C, and then wx.switchTab to A, Mini Program closed directly, I don"t know why.

add: if b is redirectTo to C page C press the mobile phone to return is also directly turn off Mini Program
what is the solution of the gods?

Apr.05,2021

two methods
1. Use the history.replaceState () method to keep only the record of page A
2. Listen for popstate events
for example:

window.onpopstate = function (event) {
    if(url==C){
         pushA   
    }
};

wx.redirectTo (OBJECT)
close the current page and jump to a page within the application.

use wx.redirectTo to jump

can't the two people upstairs see that the landlord is talking about Mini Program?


listen for the return button.

window.addEventListener('popstate', function (e) {
        // alert(''); // 
        // history.go(0);
      }, false);
Menu