Detailed explanation of the value transfer on the applet page and detailed explanation of the Applet
Detailed description of passing values on the applet page
1. Cross-page value transfer.
1. Use the navigator label to pass a value or wx. navigator, such
Here, the good_id = 16 parameter is passed into the detail page, and accepted in the onload method of the detail page.
To upload multiple parameters, use the & Link
If you want to transmit arrays, dictionaries, and other complex types, you must first convert JSON. stringify () to a string for transmission.
Note: If the converted string contains "? "This symbol will only be passed "? "The previous string, I guess this problem may be caused by the routing processing in the applet "? "Sensitive?
Well, this is the first option to use Jump URLs with parameter values.
2. Use getCurrentPages (); to get all pages in the stack, and then write the data to the corresponding page.
Here, you can upload strings or arrays,
In this way, the address is passed and accepted.
Note: This method is suitable for transmitting values (that is, existing pages) to the backend, so that data can be found in the stack and actively written, and must be accepted in the onshow () method, because only the onshow () method is executed when the result is returned again.
3. Write data locally and retrieve wx. setStorage/wx. getStorage from different pages. Many methods are encapsulated in the applet to write local data. I will not talk about it here.
4. Declare the data as a global variable
Var detail = getApp (). detail; available on any page
2. Pass the value in the page
1. Set the id method to identify the parameter passed after the jump
Obtained in the bindtap-defined click method swiperTap: function (e);, var id = e. currentTarget. id;
2. Set the data-xxx method to identify the value to be passed
Note: The {index} in data-index = "{index}" is valid. When using wx-for to render the view layer, index indicates the subscript to be clicked. obtained in the bindtap-defined click method swiperTap: function (e);, that is, var index = e. currentTarget. dataset. index; this is also true for other parameters, var type = e. currentTarget. dataset. type;
3. form and input boxes
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!