WeChat applet reports error "navigateTo:fail webview count limit exceed"

foreword

Today, I encountered an uncommon error when developing a WeChat applet. Today I will teach you how to solve the error in the figure below in one minute.

insert image description here


Problem Description:

Through the error message in the above picture, we know that the place where the error is reported is navigateTojump , and the translation of the latter meaning is probably "exceeding the page limit" .


Cause Analysis:

According to the official documentation of WeChat, wx.navigateTothe method has a maximum of ten layers in the page stack. However, due to too many clicks, an error occurs after multiple jumps.


solution:

wx.navigateToreplace withwx.redirectTo

wx.redirectToThe execution behavior of is: close the current page, and then jump to the specified page. So there will be no such problem.

Notice:

There is an obvious problem with wx.redirectTojumping . When you click the return arrow above, it does not point to the page you just opened, but redirectdirectly replaces the current page with the page you want to jump to, which becomes page redirection. When redirecting, the current page is popped out of the stack, and the new page is pushed into the stack, wx.redirectTowhich means redirection, so you cannot return to the previous page.

Guess you like

Origin blog.csdn.net/Shids_/article/details/129296875