uniapp H5 跳转微信小程序 微信开发标签(wx-open-launch-weapp)的用法

555 阅读1分钟

H5 跳转微信小程序 微信开发标签(wx-open-launch-weapp)的用法

微信官方文档链接地址:wx-open-launch-weapp

注意

开放对象:

  1. 已认证的服务号,服务号绑定“JS接口安全域名”下的网页可使用此标签跳转任意合法合规的小程序。
  2. 已认证的非个人主体的小程序,使用小程序云开发的静态网站托管绑定的域名下的网页,可以使用此标签跳转任意合法合规的小程序。
 <view class="mini-relative">
        <view>
			此处填你的内容/此处填你的内容/此处填你的内容
        </view>
        <!--   env-version:正式版release、开发版develop、体验版trial -->
        <!--   username:所需跳转的小程序原始id,即小程序对应的以gh_开头的id(跳转时,有appid会优先使用appid,没有appid才会使用username) -->
        <!--   path:所需跳转的小程序内页面路径及参数 -->
        <wx-open-launch-weapp
          id="launch-btn"
          username="gh_xxxxxxxxx"
          @ready="ready"
          @launch="handleLaunch"
          @error="handleError"
          :env-version="isMiniProd"
          :path="`pages_live/pages/live/detail?id=${liveId}&type=mini`"
          style="position: absolute;top: 0;left: 0; width: 85%;height: 100%"
        >
          <script type="text/wxtag-template">
            <div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;opacity: 0" />
          </script>
        </wx-open-launch-weapp>
      </view>
.mini-relative {
  position: relative;
  height: 110rpx;
}