Home >WeChat Applet >Mini Program Development >Implementation of page jump value transfer in WeChat applet

Implementation of page jump value transfer in WeChat applet

不言
不言Original
2018-06-23 15:35:352504browse

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, WeChat gives The method is to add objects in global variables; (what the fuck)

app.js Add variable search

search:'',

All subsequent js headers are added

let $ = getApp()

index.js:

Reset every time

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

In list.js:

Every time the view appears, the list collection is reset. The WeChat applet retains the last collection, and 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 entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

WeChat Mini Program Page jump and data transfer

#WeChat applet Implementation of sliding left to delete function

The above is the detailed content of Implementation of page jump value transfer in WeChat applet. 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