Home > WeChat Applet > Mini Program Development > WeChat Mini Program Development Guide Series: About Page Jump

WeChat Mini Program Development Guide Series: About Page Jump

高洛峰
Release: 2017-03-17 15:11:21
Original
1727 people have browsed it

From the jump method (or the way to open a new page), it can be roughly divided into: request forwarding, request redirection and TAB page jump (if you have web experience, you should be very clear about the two methods. differences), part of which comes from official documentation.

wx.navigateTo(OBJECT)

Keep the current page and jump to a page in the application. Use wx.navigateBack to return to the original page.

wx.navigateTo(OBJECT)

WeChat Mini Program Development Guide Series: About Page Jump

Note: The mini program requires that the page level can only be five levels at most, because this method retains the current Page, that is to say, jumping to the page in this way can only open up to 5 pages.

Close the current page and jump to a page within the application.

WeChat Mini Program Development Guide Series: About Page Jump

Jump to the tabBar page and close all other non-tabBar pages

WeChat Mini Program Development Guide Series: About Page Jump

##wx.navigateBack(OBJECT)

Close the current page and return to the previous page or multi-level page. You can get the current page stack through getCurrentPages()) and decide how many levels to return.

WeChat Mini Program Development Guide Series: About Page Jump

Notes:

1. It needs to be emphasized that the pages in the mini program are recorded in stack form. Every page jumped with wx.navigateTo(OBJECT) will be pushed onto the stack, but pages opened with wx.re
directTo(OBJECT) will not. Let’s borrow an official example, it’s very clear.

// 此处是A页面
wx.navigateTo({
  url: 'B?id=1'
})

// 此处是B页面
wx.redirectTo({
  url: 'C?id=1'
})

// 在C页面内 navigateBack,将返回A页面
wx.navigateBack()
Copy after login

**2.**wx.navigateTo and wx.redirectTo are not allowed to jump to the tabbar page, only wx.

switchTab can be used to jump to the tabbar page

From the writing position, it can be roughly divided into two types, one is in the form of tags in the page wxml file, and the other is in the form of code (this has been listed above and will not be repeated here) .

Component navigator page link.

WeChat Mini Program Development Guide Series: About Page Jump

Through open-type, you can specify whether the jump method is request forwarding, request redirection or TAB page jump. (The effect is the same as that of the

js code above, so I won’t go into details here)

Here is a pitfall that the author encountered, which fooled me all night. . . Also very speechless. Although it is not a problem of page jump, there is a certain connection, so let’s record it here.

Originally, my project homepage had two tabs. I needed to click on an item on one of the list pages to enter the details and view the map. However, no matter what I tried, and even after reviewing the document N times, I still couldn't solve it.

Post the exception first

WeChat Mini Program Development Guide Series: About Page Jump

The aboutUs reported in the above error is another tab on the homepage. It is just a display page with no operations, so although an error is reported, However, I didn't care. The problem is that when I jump to pages/map (detailed map), I am prompted with the error in the last line above.

Page[pages/map/map] not found. May be caused by: 1. Forgot to add page route in app.json. 2. Invoking Page() in async task.
Copy after login

According to the author's previous experience with

Android and the backend, I have always positioned the problem to the map page itself. I masturbated for a long time but still haven't solved it. Later, on a whim, I solved the anomaly in aboutUs and found that the problem was miraculously solved.

The problem lies in the aboutUs page. Because it is just a static page and has no operations, aboutUs.js is empty. This is where the problem lies.

In the mini program, even if there is no need to write js code, Page({}) must be added to the js file.

The above is the detailed content of WeChat Mini Program Development Guide Series: About Page Jump. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template