Home > WeChat Applet > Mini Program Development > WeChat applet page jump value transfer case

WeChat applet page jump value transfer case

黄舟
Release: 2017-09-13 09:35:50
Original
2264 people have browsed it

This article mainly introduces the relevant information about the WeChat Mini Program page jump value transfer implementation code. Here we analyze the implementation conditions and example code. Friends in need can refer to

WeChat Mini Program Page jump value transfer implementation code

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

The current scene is as follows:

index (home page) opens a new Page list (list) opens a new page search (conditional query) determines the conditions and returns to list (list);

There is a restriction here, WeChat can only open five layers of web pages, which means With: When you click OK on the search page, you need to return to the previous page:


wx.navigateBack(OBJECT)
Copy after login

This API cannot return to the previous page with parameters. The method given by WeChat is Add objects to global variables; (what the fuck)

app.js Add variable search


search:'',
Copy after login

Add all subsequent js headers


let $ = getApp()
Copy after login

In index.js:

Reset each time


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

In list.js:

Every time the view appears, the list collection is reset. The WeChat applet retains the previous collection, then obtains the search object and performs query operations


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

In search.js:

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


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

The above is the detailed content of WeChat applet page jump value transfer case. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template