wx-open-launch-app 监听不了问题
发布于 4 年前 作者 songna 6464 次浏览 来自 官方Issues
<!DOCTYPE html>
<!-- saved from url=(0028)http://h5.cxbtv.cn/20210315/ -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0,user-scalable=no,viewport-fit=cover">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" href="images/css.css">
    <script src="./images/jquery.min.js"></script>
    <script src="images/jweixin-1.6.0.js"></script>
    <script src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"></script>

</head>

<body style="position: relative">

    <wx-open-launch-app id="launch-btn" 
    appid="wxc66307068095b3fa"
    extinfo='{"typeId":"1","contentType":"1","source":"2","id":38154}'
    style="position:absolute;top: 0;right: 0;bottom: 0;left: 0;"
    >
        <template>
            <style>
                img {
                    width: 100%;
                    display: inline-block;
                }
            </style>
            <img src="" />
        </template>
    </wx-open-launch-app>

    
    <script>
        wx.config({
            debug: true,//开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印
            appId: '',// 必填,企业号的唯一标识,此处填写企业号corpid
            timestamp: ,// 必填,生成签名的时间戳
            nonceStr: '',// 必填,生成签名的随机串
            signature: '',// 必填,签名
            jsApiList: [
                'onMenuShareTimeline',
                'onMenuShareAppMessage',
            ],// 必填,需要使用的JS接口列表
            openTagList: ['wx-open-launch-app']
        });
        wx.ready(function() {
            wx.onMenuShareAppMessage({
                title: "",//分享标题
                desc: "",
                link: "/",// 分享链接,将当前登录用户转为puid,以便于发展下线
                imgUrl: "",// 分享图标
                success: function(res) {}
            });
            wx.onMenuShareTimeline({
                title: "",
                desc: "",
                link: "",
                imgUrl: "",
                success: function(res) {}
            });
            var btn = $("#launch-btn")[0];
            console.log(btn)
            btn.addEventListener('click', function(e) {
                console.log('click');
            });
            btn.addEventListener('launch', function(e) {
                console.log('launch');
            });
            btn.addEventListener('error', function(e) {
                console.log('fail', e.detail);
                window.location.href = '';
            });
        });
        var vConsole = new VConsole();
        wx.error(function (res) {
            //如若报错可以打印看下
            alert(JSON.stringify(res))
        });
    </script>
    
    
</body>
</html>
1 回复

监听不了什么问题?请详细描述下你的问题

回到顶部