Scan the QR code of the ordinary link to open the applet

1. If you want to scan the QR code of the ordinary link to open the applet, you must configure it in the background of the applet, otherwise it cannot be completed.

Written in front: WeChat has certain restrictions on scanning the QR code of ordinary links to open the applet. This function is open to enterprise, media, government, and other organization-type applet programs . Personal-type applet programs do not support opening at the moment. In addition, in order to ensure the user experience, the applet must first publish the code before publishing the QR code jumping rules.

1. First enter the WeChat public platform and log in to the mini program background management


2. Select the last item "Settings" in the menu bar, then select "Development Settings", slide down the page to the last item "Scan the QR code of the ordinary link to open the applet", and "Enable" this function



3. Enter the configuration. It is recommended to read the development documentation carefully before configuration. You can configure the test link and test it during development.


2. Parameter processing after scanning the code and entering the applet

After WeChat recognizes the QR code and enters the applet, it will pass the link of the QR code into the applet in the form of parameter "q", extract the "q" parameter in the onLoad event and UrlDecode it once to obtain the complete content of the original QR code .

We pass the "onload" options "parameter object to get the parameters passed in by the page

onLoad: function (options){
    console.log(decodeURIComponent(options.q));
}


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324497531&siteId=291194637