开放标签wx-open-launch-weapp的一些问题认知
发布于 4 年前 作者 min92 429 次浏览 来自 分享

先上代码:

 普通HTML版本为:(由于使用代码选项,保存无法显示,所以只能文本显示了)

<div class="test-position"

  <wx-open-launch-weapp id="launch-btn" username="gh_**  *" path="pages/index/index.html?user=123&action=abc">

    <template>

      <style>.btn { padding: 12px; height: 100px; width: 120px; }</style>

        <button class="btn">打开小程序-测试方法二</button>

    </template>

  </wx-open-launch-weapp>

</div>

 

如果是使用框架,则为:

<div class="test-position">

   <wx-open-launch-weapp id="launchWeapp" username="gh_***" :path="`/homeModule/previewCard/previewCard.html?cardId=${data.id}`">

    <script type="text/wxtag-template">

      <style>.btn {width: 750px; height: 107px;}</style>

         <button class="btn"></button>

     </script>

    </wx-open-launch-weapp>

</div>

如果框架写上还不行,可以试试在文件main.js中,写上:
Vue.config.ignoredElements = ['wx-open-launch-app''wx-open-launch-weapp'];


代码就写完了,说说需要注意的几点吧:

1、在开放标签中,<template>或者<script>里面的写样式,千万不要使用定位position,如果非要用就在最外层的div里面写,例如我这里的class=‘test-position’这里定位;

2、如果你觉得里面写样式不好写,可以在里面样式style写opacity:0;,这样的话开放标签只是用来填充,大小自己控制就行;

3、如果你跳转之后显示页面不存在,请检查下path的路径结尾是否写上了.html;

4、开发工具是无法测试的,只能使用手机测试,如果你在手机分享功能正常,说明你初始化授权没问题,记得要在初始化授权写上开放标签openTagList: ['wx-open-launch-weapp'];如果手机发现按钮不见了,初始化授权是ok的,只是标签写法出来问题;请查看其他注意点;

微信版本要求为:7.0.12及以上。 系统版本要求为:iOS 10.3及以上、Android 5.0及以上。

5、如果还不行,然后初始化授权也是成功的,请质疑一下后台初始化授权信息的jssdk中,APPID是否你想要的公众号,眼见为实;

6、如果还不行,请移步到微信官网查看是否有其他问题:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html

1 回复

据一些人反馈,在服务号配置好安全域名,马上使用是标签是无反应的,可能存在延时,需要等待一段时间

回到顶部