WeChat applet page Jump to pass value implementation code, Applet jump

Source: Internet
Author: User

Code for transferring values from the page of the applet and the Code for redirecting from the Applet

Code for transferring values from a page to a Applet

The page path of the applet can only be five layers;

The current scenario is as follows:

Index (homepage) opens a new page list (list) opens a new page search (conditional query) determines the conditions returned by the list (list );

There is a limit that only five pages can be opened, which means that when you click OK on the search page, you will return to the previous page:

wx.navigateBack(OBJECT) 

This api cannot return the previous page with parameters. The method provided is to add an object to the global variable)

App. js adds the search variable

search:'', 

Add all subsequent js Headers

let $ = getApp() 

In index. js:

Reset each time

onShow: function () {  $.search='';  }, 

In list. js:

Each time the list set is reset in the view, the applet retains the previous set, obtains the search object, and performs the query operation.

onShow: function () {  this.data.list = [];  if ($.search != '') {   this.data.search=$.search;  }  this.loadMore();  }, 

In search. js:

Click search to trigger the onSubmit event, assign a value to search, and return to the previous page.

onSubmit() {  $.search = this.data.model;  wx.navigateBack(); } 

The above is an example of transferring values from the page of the applet. There are many articles about the applet on this site. You are welcome to refer to this Article. Thank you for reading it and hope it will help you, thank you for your support!

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.