Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize shared variable value in WeChat Mini Programs

Shulou Source: shulou.com Published: 2022-05-31 23:23:15 09月21日 Update

This article introduces in detail "How to realize shared variable value in Weixin Mini Programs (Mini)," with detailed content, clear steps and proper details. I hope this article "How to realize shared variable value in Weixin Mini Programs" can help you solve your doubts. Let's go deep into the idea of small editor and learn new knowledge together.

Realization of Shared Variable Values for Weixin Mini Programs

For example, for example, from the commodity management list page, to modify the commodity published by oneself, click the modify button, and modify this commodity through the unique identifier of activityId. We can transfer the value of this activityId through page jump.

Get it in onLoad,

Examples:

onLoad: function (options) { var activityId = options.activityId; //Get value this.data.activityId = activityId//settings can be called in the page

Suppose I were to use activityId in the form submission method

Examples:

submit: function(e){ var activityId = this.data.activityId //Get activityId }

This avoids using global variables to take values

Read here, this article "How to realize shared variable values in Weixin Mini Programs" has been introduced. If you want to master the knowledge points of this article, you need to practice and use them before you can understand them. If you want to know more articles related to content, please pay attention to the industry information channel.

Tags: Programs values examples commodities articles content variables appropriate global can be passed ideas buttons new knowledge methods more identification steps knowledge knowledge points articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno macOS Huawei MariaDB Xiaomi