这篇文章主要介绍在html5跳转小程序使用wx-open-launch-weapp的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

1.正常操作,公众号后台绑定域名
2.引入weixin.js 目前是1.6.0版本
3.调用wx.config 在openTagList中加入要使用的开放标签
接下来坑来了,文档上使用示例如下

<wx-open-launch-weappid="launch-btn"username="gh_xxxxxxxx"path="pages/home/index.html?user=123&action=abc"><template><style>.btn{padding:12px}</style><buttonclass="btn">打开小程序</button></template></wx-open-launch-weapp><script>varbtn=document.getElementById('launch-btn');btn.addEventListener('launch',function(e){console.log('success');});btn.addEventListener('error',function(e){console.log('fail',e.detail);});</script>

贴在vue中 无法使用,排查发现是template标签的问题:

<divclass="center"ref="launchBtnHome"><wx-open-launch-weappid="launch-btn"username="gh_xxxxxxxx"path="pages/index/index/index"ref="launchBtn"><scripttype="text/wxtag-template"><style>.jump-btn{height:44px;line-height:44px;border:none;font-size:16px;color:#ffffff;background-color:#f94048;text-align:center;}</style><divclass="jump-btn">打开小程序</div></script></wx-open-launch-weapp></div>

以上是“在html5跳转小程序使用wx-open-launch-weapp的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!