Home > WeChat Applet > WeChat Development > Code example for implementing WeChat applet routing to jump to a specified page

Code example for implementing WeChat applet routing to jump to a specified page

Y2J
Release: 2017-05-02 10:06:30
Original
3425 people have browsed it

Code example for implementing WeChat applet routing to jump to a specified page

How to implement WeChat applet routing to jump to a specified page? There are three forms of routing jumps for WeChat mini programs. The navigator component is used in the page to make routing jumps in the form of page links. In js, wx.navigateTo can be used to retain the current page and jump to a certain page in the application, wx. redirectTo--Close the current page and jump to a page within the application wx.navigateBack()--Close the current page and go back to the previous page.

The navigator component makes page links

Page links.

Code example for implementing WeChat applet routing to jump to a specified page

Note: The default background color of navigator-hover is {background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;}, and the background color of the child node should be For transparent color

Sample code:

/** wxss **//** 修改默认的navigator点击态 **/
.navigator-hover 
{    
color:blue;
}
/** 自定义其他点击态样式类 **/
.other-navigator-hover 
{    
color:red;
}
Copy after login
 跳转到新页面  在当前页打开(关闭了当前页面)
Copy after login
 {{title}}  点击左上角返回回到之前页面
Copy after login
 {{title}}  点击左上角返回回到上级页面
Copy after login
// redirect.js navigator.jsPage({  onLoad: function(options) {    this.setData({      title: options.title }) }})
wx.navigateTo(OBJECT)
Copy after login

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

OBJECT parameter description:

Code example for implementing WeChat applet routing to jump to a specified page

Sample code:

wx.navigateTo({  url: 'test?id=1'})
Copy after login

Note: In order not to cause trouble to users when using the mini program, we It is stipulated that the page path can only be five levels, so please try to avoid multi-level interactions.

wx.redirectTo(OBJECT)
Copy after login

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

OBJECT parameter description:

Code example for implementing WeChat applet routing to jump to a specified page

Sample code:

wx.redirectTo({  url: 'test?id=1'})
wx.navigateBack()
Copy after login

Close the current page and go back to the previous page.

The above is the detailed content of Code example for implementing WeChat applet routing to jump to a specified page. 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