Since the wechat open label documentation is not very clear, most developers read it and say: Where do I come from? Where are you going?

So I record this article in order to help some people.

No more nonsense, on the talent!

<html>
<head>
    <meta charset="utf-8">
    <meta name = "viewport" content = "width = device-width, initial-scale = 1.0, maximum-scale = 1.0, user-scalable = 0"/> <title> </head> <body style= "box-sizing: border-box! Important"text-aligin:center;">
<wx-open-launch-weapp
        id="launch-btn"
        username="gh_e16de8f****"<! -- Fill in the original ID of the applet --> path="/pages/index/index.html"> <! <template> <style>. BTN {padding: 12px; width:200px; height:50px; }</style> <button class="btn""> </button> </template> </ wX-open-launch-appellate > <script SRC =" appellate""/ js/jquery - 1.12.4. Js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> <! <script> $(function=== start var url = location.href; varfunctions = "updateAppMessageShareData";
        $.get("https://xxx.com/wechat/jssdk/config", {"functions":functions}, function(response){
            if(response.status == 0) {
                var info = response.data;
                wx.config({
                    debug: false,
                    appId: info.appId,
                    timestamp: info.timestamp,
                    nonceStr: info.nonceStr,
                    signature: info.signature,
                    jsApiList: info.jsApiList,
                    openTagList: ['wx-open-launch-weapp'}); }}); End var BTN = document.getelementById ('launch-btn');
        btn.addEventListener('launch'.function (e) {
            console.log('success');
        });
        btn.addEventListener('error'.function (e) {
            console.log('fail', e.detail);
        });
    });
</script>
</body>
</html>
Copy the code

Open objects:

1, the authenticated service number, the service number bound to the "JS interface security domain name" under the web page can use this label to jump to any legal and compliant small program. 2, has been certified non-personal subject small program, using small program cloud development static website hosting bound under the domain name of the web page, can use this label jump to any legal compliance small program.Copy the code

Client Requirements

Wechat version requirements: 7.0.12 or later. The system version must be iOS 10.3 or later, and Android 5.0 or later. Note: Wechat developer tools are temporarily not supported! Therefore, it is recommended to test directly using mobile phone access.Copy the code

Other instructions

This function is actually very simple, not as complicated as imagined. The essence is that you can customize sharing to moments or friends on the basis of config more

openTagList: ['wx-open-launch-weapp']
Copy the code

It is also important to note that the page URL of path must have an.html argument that follows the HTML.

<wx-open-launch-weapp
        id="launch-btn"
        username="gh_e16de8f****"<! -- Fill in the original ID of the applet --> path="/pages/index/index.html">
        
<wx-open-launch-weapp
        id="launch-btn"
        username="gh_e16de8f****"<! -- Fill in the original ID of the applet --> path="/pages/index/index.html? id=123">
Copy the code

The last

This is the first time that the author writes thing, if have inadequacy place hope sea excuse!

If you are not clear, you can leave a message below and I will reply as much as possible.

Reprint please famous source.