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!