Solution to the problem that the wx.navigateTo page does not jump when the WeChat applet appears

小云云
Release: 2021-05-28 16:36:05
Original
7194 people have browsed it

This article mainly introduces the solution to the problem that the wx.navigateTo page does not jump in the WeChat applet. It briefly analyzes the reasons and the corresponding solutions for the problem that the wx.navigateTo page does not jump in the WeChat applet. Friends who need it can For reference, I hope it can help everyone.

Today when I was working on the WeChat applet, I went through the product purchase process. The process is as follows:

Product display-->Product details-->Order page-->Order details page-->Payment result page-->Jump to order details page .

But after the payment was successful, I clicked the button to jump and found that I could not jump to the order details page. The front and back logs could be printed out, proving that the wx.navigateTo method had been executed, but the jump was unsuccessful. Moreover, the trick is that it does not report an error.

Look through the WeChat applet development documentation, reference link:

https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui-navigate.html#wxnavigatetoobject

There is a line mentioned:

This is the sentence: "Note: In order to prevent users from causing trouble when using the mini program, we specify the page path There can only be five layers. Please try to avoid multi-level interactions. "Count my jump pages. Of course, you can look at the upper right corner of the preview view of WeChat developer work. There will be 5 pages you are currently debugging. Such tips.

Post my page jump situation again:

① Product display-->② Product details-->③ Order page-->④ Order details page- ->⑤ Payment result page-->⑥ Jump to order details page.

At the last step, it is no longer possible to jump. At this time, wx.navigateTo has been used to jump to five pages, which has just reached the limit.

Then I tried to use the wx.redirectTo() method to jump to the order details page when the order page was placed, and then compiled and executed, and found that the jump to the order details page was successful. Then I converted some jumps that did not require returning to the current page into wx.redirectTo() to jump, which solved the problem of unsuccessful wx.navigateTo jumps.

wx.redirectTo() method opens a new page and closes the current page. This can be understood using the startup mode of android. Just like a bucket, or a stack, this bucket can only hold 5 watermelons. Originally, there are no watermelons in the bucket. Then when we open a page and start it using the wx.navigateTo method, we throw a watermelon into the bucket. After these five are full, if you open a new page and throw watermelon into the bucket, it will definitely not be able to hold it. If we use wx.redirectTo(), when we open a new page, we will also throw a watermelon into the bucket, and then eat the current watermelon in the bucket, thus leaving space.

So, in the WeChat applet page jump, if the current page is unnecessary after the jump, and there is no need to return to this page, try to use wx.redirectTo() to jump Open a new page to avoid the above problems.

Related recommendations:

Example tutorial on WeChat applet recording and playback recording function

Example detailed explanation of WeChat applet uploading pictures to the server

WeChat applet ajax implementation request server data instance

The above is the detailed content of Solution to the problem that the wx.navigateTo page does not jump when the WeChat applet appears. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!