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里都可以进行调用
If I want to use the activityId variable in the form submission method now
Example:
submit: function(e){ var activityId = this.data.activityId //获取 activityId }
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!