Home  >  Article  >  WeChat Applet  >  Introduction to the method of realizing shared variable values ​​in WeChat applet

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

黄舟
黄舟Original
2018-05-10 14:29:423661browse

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!

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