How to get the parameters shared by Aladdin QR code in Mini Program app.js?

how to get the parameters of Aladdin"s QR code sharing in Mini Program app.js, be sure to get

before login operation.
Feb.28,2021

    The sharing parameters of the
  1. QR code are in the options.q attribute.
  2. options this object is available in the onLaunch , onShow of the registrant, and onLoad of the registration page.

so, you just need to get options before invoking the life cycle of the login operation.


The

upstairs positive solution we often use in development is that the code scanning function has recently done a
e.q parameter that needs to be parsed with the decodeURIComponent function. For details, you can check Baidu
and convert it into an object after parsing as follows:

GetRequest(url) {
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.split('?')[1];
        let strs = str.split("&");
        for (var i = 0; i < strs.length; iPP) {
            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
        }
    }
    return theRequest;
},

then you can get the parameters brought by the normal QR code

Menu