The applet returns an error on the page: navigateBack:fail cannot navigate back at first page.

When debugging the applet, I jumped from the home page to another page. In the function bound to the bindtap event of the other page, I called the function wx.navigateBack(), but instead of jumping back to the previous page, an error was reported:
report error

The literal meaning is also very simple. It means that this page is already the first page, and there is no way to return.

The reason for this error is actually simple, that is, it is used when jumping wx.redirectTo(), wx.redirectTo()which is equivalent to redirection, and it is not counted as jumping from the previous page, so the page after the jump is regarded as the first page.

The solution is to wx.redirectTo()replace the wx.navigationTo().

After jumping in this way, click Back to return to the previous page successfully.

Guess you like

Origin blog.csdn.net/qq_34972627/article/details/127553980