Implementation of page jump value transfer in WeChat applet

不言
Release: 2018-06-23 15:35:35
Original
2390 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, WeChat gives The method is to add objects in global variables; (what the fuck)

app.js Add variable search

search:'',
Copy after login

All subsequent js headers are added

let $ = getApp()
Copy after login

index.js:

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

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!