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!