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.
Problem Description:
Through the error message in the above picture, we know that the place where the error is reported is navigateTo
jump , and the translation of the latter meaning is probably "exceeding the page limit" .
Cause Analysis:
According to the official documentation of WeChat, wx.navigateTo
the 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.navigateTo
replace withwx.redirectTo
wx.redirectTo
The 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.redirectTo
jumping . When you click the return arrow above, it does not point to the page you just opened, but redirect
directly 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.redirectTo
which means redirection, so you cannot return to the previous page.