In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "WeChat Mini Programs how to transfer value on the page", so the editor summarizes the following contents to you. The content is detailed, the steps are clear, and it has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "WeChat Mini Programs how to transfer value on the page" article.
Detailed explanation of WeChat Mini Programs's page transfer value
one。 Pass values across pages.
1. Use the navigator tag to pass a value or wx.navigator, such as
Here, the good_id=16 parameter is passed into the detail page, and then accepted in the onload method of the detail page.
If you need to pass multiple parameters, you can use the & link
If you want to pass complex types such as arrays, dictionaries, etc., you should first use JSON.stringify () to convert to a string.
Note: if there is "?" in the converted string This symbol will only convey "?" The previous string, I guess it may be the internal routing processing of Mini Program for this "?" Sensitive, right?
Okay, this is the first url that relies on jumping to pass values with parameters.
2. Use getCurrentPages (); to get all the pages in the stack, and then write the data to the corresponding page
Here you can pass strings, arrays, etc.
So the address is passed and accepted.
Note: this method is suitable for passing values later (that is, pages that already exist), so that you can find and actively write data on the stack, and be sure to accept it in the onshow () method, because the return only executes the onshow () method.
3. Write locally, take out wx.setStorage/wx.getStorage across pages, etc. Mini Program encapsulates many methods for writing local data, each with its own emphasis, so I won't say much here
4. Declare data as global variables
Var detail = getApp (). Detail; is available on any page
two。 Pass values inside the page
1. Set the method of id to identify the parameters passed after the jump
Get it in the click method swiperTap: function (e); defined by bindtap, var id = e.currentTarget.id
2. Set the method of data-xxx to identify the value to be passed
Note: here {{index}} in data-index= "{{index}}" is valid. When rendering the view layer with wx-for, index represents the subscript clicked. Get it in the click method swiperTap: function (e); defined by bindtap, that is, var index = e.currentTarget.dataset. Index; the same is true for other parameters taken out, var type = e.currentTarget.dataset.type
3. Form form and input input box
The above is about "WeChat Mini Programs how to achieve page value" of this article, I believe we all have a certain understanding, I hope the editor to share the content to help you, if you want to know more related knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.