关于前端:微信内h5跳转小程序

最近有一个需要,微信内h5跳转小程序,扒了扒微信社区,才晓得5月份不吭不响的上线了能够实现跳转h5的标签,话不多说,上代码

 <wx-open-launch-weapp v-if="weChat" id="launch-btn" username="gh_xxxxxxxxx"
            path="/a/b/c.html" @error="handleErrorFn" @launch="handleLaunchFn">
            <template>
              <script type="text/wxtag-template">
                <div style='position:relative'>
            <div style="text-align:center;"><button class="wx-btn">点击跳转小程序</button></div>        
        </div>
        </script>
       </template>
 </wx-open-launch-weapp>
    handleErrorFn(e) {
      console.log("fail", e.detail)
    },
    handleLaunchFn(e) {
      console.log("success")
    }

username为小程序原始id,path为小程序的页面门路,
切记,须要引入1.6版本的sdk,在须要调用JS接口的页面引入如下JS文件:http://res.wx.qq.com/open/js/… (反对https)
本篇介绍的是vue的语法调用,如其余框架请参照微信凋谢文档即可
https://developers.weixin.qq….

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理