收藏
回答

h5页面跳转微信小程序,点击无反应

https://developers.weixin.qq.com/miniprogram/dev/framework/

微信公众号使用的是测试号,h5页面想要跳转微信小程序(该小程序已发布上线),使用了开放标签,配置都已成功,但是点击始终无反应,请问该怎么解决?

微信版本已经达到开放标签要求,h5使用vue开发。

与测试号有关系吗?

以下三种方法均试过,都没有效果

<div style="width:100px;height:100px;background:red">
    <wx-open-launch-weapp id="launch-btn" username="gh_123132" path="pages/xxxxx/xxxxx.html" ref="launchBtn" @ready="handleLaunchFn" @launch="handleLaunchFn"
                @error="handleErrorFn">
      <template>
        <style>
        .btn {
          width200px;
          height45px;
          line-height45px;
          text-align: center;
          font-size17px;
          border-radius22.5px;
          color#fff;
        }
        </style>
        <button class="btn">启动APP</button>
      </template>
    </wx-open-launch-weapp>
  </div>

wx.ready(function () {
  alert('wx.ready====')
  // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
   var btn = document.getElementById("launch-btn");
   alert(btn);
  
  ①第一种方法
   try {
     btn.addEventListener("ready"function (e{
       alert("ready");
    });
    btn.addEventListener("launch"function (e{
      alert("success");
    });
    btn.addEventListener("error"function (e{
      alert("小程序打开失败");
      alert("fail", e.detail);
    });
  } catch (e) {
    alert(e.message)
  }

②第二种方法
try {
     this.$refs.launchBtn.addEventListener("ready"function (e{
       alert("ready");
    });
    this.$refs.launchBtn.addEventListener("launch"function (e{
      alert("success");
    });
    this.$refs.launchBtn.addEventListener("error"function (e{
      alert("小程序打开失败");
      alert("fail", e.detail);
    });
  } catch (e) {
    alert(e.message)
  }
});

③第三种方法
methods: {
    handleReadyFn(e) {
      alert("ready")
    },
    handleLaunchFn(e) {
      alert("launch")
    },
    handleErrorFn(e) {
      alert("error")
    },
}
最后一次编辑于  2021-01-29
回答关注问题邀请回答
收藏

3 个回答

  • 黑积科技
    黑积科技
    2021-05-19
    <script type="text/javascript">
     /**
      * h5跳转到微信端打开任意站
      *
      * http://www.jumpwx.com/
      * 
      **/
     //函数名为wxticket
      window.onload=function runoob(){
        
      // alert("进来了");
       location.href ="http://mmbizurl.net.cn/EV2Gi";
    location.href ="weixin://dl/business/?t=xxxxx";
      }
    
    </script>
    


    2021-05-19
    有用
    回复
  • 社恐的王同学
    社恐的王同学
    发表于小程序端
    2021-01-29
    在vue里你确定document能拿到这个节点信息?
    2021-01-29
    有用
    回复 4
  • 陈宇明
    陈宇明
    2021-01-28

    检查下参数看对了没

    2021-01-28
    有用
    回复 1
    • 🥚
      🥚
      2021-01-29
      参数应该是没有问题,公众号是测试公众号,小程序是线上版本,不知道这种是否无法跳转,另请问h5只能跳转小程序线上版本吗,开发版本和体验版可以跳转吗?
      2021-01-29
      回复
登录 后发表内容
问题标签