When developing a WeChat applet, the error navigateBack:fail cannot navigate back at firstpage is reported.

The meaning of this error is: This page is already the first page and there is no way to return.

Reason for error

The reason for this error is actually simple. It is using wx.redirectTo() when jumping. Using wx.redirectTo() is equivalent to redirecting. It does not count as jumping from the previous page, so the page after the jump is As the first page.

The solution is to replace wx.redirectTo() with wx.navigateTo().

After this jump, click Return to successfully return to the previous page.

My code is as follows, to change redirectTo to navigateTo:

Guess you like

Origin blog.csdn.net/weixin_44786530/article/details/134955195