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

WeChat applet page jump value transfer case

黄舟
黄舟Original
2017-09-13 09:35:502262browse

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)

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:'',

Add all subsequent js headers


let $ = getApp()

In index.js:

Reset each time


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

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(); 
 },

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(); 
}

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!

Statement:
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