收藏
回答

wx-open-launch-app 按钮内容不显示?

测试地址:https://dict.eudic.net/Courses/index/?appkey=eusoft_ting_en_iphone&courseId=f108a92f-f050-48b2-8f59-f3cc05fac17a&sourcefrom=share

微信版本:8.0.2

设备:iphone11

运行结果:wx.ready运行成功,wx.error也没有报错。但是打开按钮就是不显示

公众号appid:wxcde3c24f7569ba13

移动应用appid:wx3d9bc15510620bf2

这些条件都是满足的

但是debug显示为false

代码:

  
       <wx-open-launch-app id="launch-btn" appid="wx3d9bc15510620bf2" extinfo="">
            <template>
                <style>
                  .btn {
                    width70px;
                    height30px;
                    line-height30px;
                    text-align: center;
                    font-size15px;
                    colorrgb(49149252);
                    border-radius:50px;
                    border2px solid rgba(49,149,252,0.50);
                         }
                   </style>
                   <button class="btn">打开</button>
           </template>
      </wx-open-launch-app>
    
       
          $.ajax({
                url"/ting/WeChatSignatureUrl?url=" +encodeURIComponent(window.location.href),
                type"GET",
                dataType'json',
                successfunction (data{
                    var param=data;
                    configParam(param);
                },
                errorfunction (err{
                    console.log("err: " + err)
                }
            });
           
            function configParam(param{
                console.log(param)
                wx.config({
                    debugtrue,
                    appId: param.AppId, 
                    timestamp: param.Timestamp,
                    nonceStr: param.Noncestr, 
                    signature: param.Signature,
                    jsApiList: ['checkJsApi'], 
                    openTagList: ['wx-open-launch-app'] 
                });
          
                wx.ready(function () {
                    wx.checkJsApi({
                        jsApiList: ['wx-open-launch-app'],
                        successfunction (res{
                            console.log('可用')
                        },
                        fail(err) => {
                            console.log(err, '不可用')
                        }
                    })
                });
                wx.error(function (res{
                    console.log(res)
                });


            }


            var launchBtn = document.getElementById('launch-btn');
            if (launchBtn) {
                launchBtn.addEventListener('launch'function (e{
                    console.log('success');
                });
                launchBtn.addEventListener('error'function (e{
                    console.log('fail', e.detail);
                });
            }
      
 
        
    
   

    
最后一次编辑于  03-04
回答关注问题邀请回答
收藏

3 个回答

  • 凌风
    凌风
    03-19

    解决了,代码没有问题。因为该页面之前已经有微信分享相关的代码,就是说有两个config,这是不可以的。但是我隐藏了一个config还是不行,经过查验,是因为页面上有好几个jweixin不同版本的js。我把jweixin-1.3.2.js、jweixin-1.2.0.js这些都删了,只留下jweixin-1.6.0.js即可

    03-19
    有用
    回复 1
    • 沐阳
      沐阳
      04-26
      我只有这一个也不行,,按钮都显示不出来
      04-26
      回复
  • 陈进杰
    陈进杰
    03-03

    请问问题有答案了吗,我这边也遇到的同样的问题

    03-03
    有用
    回复
  • 大兵
    大兵
    03-03

    把debug打开看看

    03-03
    有用
    回复 1
    • 凌风
      凌风
      03-03
      03-03
      回复
登录 后发表内容
问题标签