收藏
回答

h5唤起微信小程序?

<html>
<head>
    <title>打开小程序</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
    <script>

    </script>
    <!-- 引入jQuery -->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>


    <!-- 公众号 JSSDK -->
    <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>

    <script>






        wx.config({
            debug: true, // 调试时可开启
            appId: 'wxece3a9a4c82f58c9', // <!-- replace -->
            timestamp: 0, // 必填,填任意数字即可
            nonceStr: 'nonceStr', // 必填,填任意非空字符串即可
            signature: 'signature', // 必填,填任意非空字符串即可
            jsApiList: ['chooseImage'], // 必填,随意一个接口即可
            openTagList: ['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
        })
        wx.ready(function () {
            console.log("接口验证成功");
        });
        wx.error(function (res) {
            console.log('res', res);
        });





    </script>

</head>
<body>
<div class="page full">
    <wx-open-launch-weapp
            id="launch-btn"
            appid="wxece3a9a4c82f58c9"

    >


        <button >打开小程序</button>

    </wx-open-launch-weapp>
    <script>
        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>

</div>
</body>
</html>

{“realAuthUrl”:[“http://

app.gohong.com/”],“errMsg”

:“config:invalid signature”}

回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容