In WeChat applet development, wx.redirectTo and wx.navigateTo failed to jump to the page

In the development of learning applets, it is inevitable that some pits will be encountered. When the author encounters a successful login when performing the login function, the page cannot be redirected to the personal center (admin / admin).
First introduce the logic of this article : After verifying the user information, you need to jump to the personal center ( tabBar page ). The two methods of wx.redirectTo and wx.navigateTo are not implemented, and no error is reported.
 
The main reason :
 
   admin / admin belongs to the tabBar page, and the above two methods will not have any effect. You need to use the wx.switchTab method to jump.
 
 

 

Jump to completion page:

 

 


 

 Page jump method:

 
1. wx.navigateTo keep the current page, jump to a page in the application, use wx ...
2. wx.redirectTo close the current page and jump to a page in the application.
3. wx.switchTab jumps to the tabBar page and closes all other non-tabBar ...
4. wx.navigateBack Close the current page and return to the previous page or multi-level page. accessible...
5. wx.reLaunch closes all pages and opens to a page in the application.

 There are several main causes of problems in page jumps:

① First check if the page is registered in app.json, if you don't register, you can't find the page.

② Pay attention to the hierarchical relationship of folders, and pay attention to whether the relative path is correct.

③ Check whether the number of levels of the one-time jump page exceeds 5 levels (Yes, select wx.redirectTo)

④ Check if the page you want to jump to is a tabBar page (yes, select wx.switchTab)

Guess you like

Origin www.cnblogs.com/giserjobs/p/12677064.html