Introduction to the method of realizing shared variable values in WeChat applet

黄舟
Release: 2018-05-10 14:29:42
Original
3568 people have browsed it

This article mainly introduces the relevant information on the implementation of shared variable values in WeChat mini programs. Friends in need can refer to

The implementation of shared variable values in WeChat mini programs

For example, from the product management list page, you can modify the product you published, click the modify button, and modify the product through the activityId unique identifier. We can pass the value of this activityId through page jump,

Obtained in onLoad,

Example:

onLoad: function (options) { var activityId = options.activityId; //获取值 this.data.activityId = activityId//设置在page里都可以进行调用
Copy after login

If I want to use the activityId variable in the form submission method now

Example:

submit: function(e){ var activityId = this.data.activityId //获取 activityId }
Copy after login

This way you can avoid using global variables to get values

The above is the detailed content of Introduction to the method of realizing shared variable values 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!