Explanation of several methods for transferring values during page jump of WeChat applet

Source: Internet
Author: User
This article mainly introduces detailed information about several methods for transferring values through page jump of applets, for more information, see the next article. This article mainly introduces the relevant information about several methods for transferring values on page jumps of applets. For more information, see

Transfer value for page jump of Applet

There are two forms of Applet navigation: one is to jump in js, and the other is to jump in wxml page.

1. js navigation

(1) wx. navigateTo (OBJECT): retains the current page and jumps to a page in the application. you can use wx. navigateBack to return to the original page.

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

Obtain the passed value:

//test.js Page({  onLoad: function(option){   console.log(option.id)  } })

(2) wx. redirectTo (OBJECT): Closes the current page and jumps to a page in the application.

wx.redirectTo({  url: 'test?id=1' })

(3) wx. navigateBack (OBJECT): Closes the current page and returns the previous page or multi-level page. You can use getCurrentPages () to obtain the current page stack and determine the number of layers to be returned.

2. wxml navigation

Navigator: page link.

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

Sample code:

/** Wxss ** // ** modify the default navigator click State **/. navigator-hover {color: blue;}/** custom other click style classes **/. other-navigator-hover {color: red ;}

   
  
   
Jump to new page
    
  
   
Open on current page
   
 

Obtain the value passed on the page:

// redirect.js navigator.js Page({  onLoad: function(options) {   this.setData({    title: options.title   })  } })

Thank you for reading this article. I hope it will help you. thank you for your support for this site!

For more details about how to transfer the page jump value of small programs, refer to the PHP Chinese network!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.