收藏
回答

H5跳转小程序问题,按钮不显示?

Vue代码,main.js已经配置过

<wx-open-launch-weapp id="launch-btn" username="gh_d11889f4cf09" path="pages/home/index" class="bb">
    <script type="text/wxtag-template">
      <style>.btn {width200pxheight100px;}</style>
<button class="btn">打开测试小程序</button>
</script>
  </wx-open-launch-weapp>

开发者工具中报这个错误

VM2284:1 [WXTAG] [JSCORE] The slot <template> or <script type="text/wxtag-template"> of <wx-open-launch-weapp> is missing

r然后手机里面 按钮都不出现,请问为啥啊

回答关注问题邀请回答
收藏

3 个回答

  • 睡前原谅一切
    睡前原谅一切
    2021-05-31
    1. 已认证的服务号
    2. 已配置js安全域名
    3. 提供链接
    示例:https://m.qtshe.com/app/dunhuang
    
    
    

    2021-05-31
    有用 1
    回复 9
    查看更多(4)
  • 哈罗哈皮
    哈罗哈皮
    2021-06-01

    开发工具是看不了效果,只有真机且绑定的安全域名下才能正常显示

    2021-06-01
    有用
    回复
  • 十二篇
    十二篇
    2021-05-31


    vue3.0写的,main.js配置了

    import { createApp } from 'vue'
    import App from './App.vue'
    import router from './router'
    import store from './store'
    import 'vant/lib/index.css';
    import axios from 'axios'
    import wx from 'weixin-js-sdk'
    
    
    /**
     * 微信分享
     */
    axios.get('https://mall.smell-lab.cn/inc/wechat_api.php', { params: { urlwindow.location.href } }).then((res) => {
      let { data } = res;
      console.log(data);
      wx.config({
        debugtrue// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
        appId: data.appId, // 必填,公众号的唯一标识
        timestamp: data.timestamp, // 必填,生成签名的时间戳
        nonceStr: data.nonceStr, // 必填,生成签名的随机串
        signature: data.signature,// 必填,签名,见附录1
        jsApiList: [
          // 'onMenuShareAppMessage',
          // 'onMenuShareTimeline'
          'updateAppMessageShareData',
          'updateTimelineShareData',
        ], // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
        openTagList: ['wx-open-launch-weapp']
      })
    
    
    })
    
    
    // 自适应
    fnResize()
    window.onresize = function () {
      fnResize()
    }
    function fnResize () {
      var deviceWidth = document.documentElement.clientWidth || window.innerWidth
      if (deviceWidth >= 750) {
        deviceWidth = 750
      }
      if (deviceWidth <= 320) {
        deviceWidth = 320
      }
      document.documentElement.style.fontSize = (deviceWidth / 75 * 2) + 'px'
    }
    
    
    // localStorage.setItem('openid', 'oDPcEs7npu-9nk1_OB1W3NA-UbNQ')
    const app = createApp(App)
    // 忽略开放标签的检查
    // app.config.ignoredElements = ['wx-open-launch-app']
    app.config.isCustomElement = tag => ['wx-open-launch-app'].includes(tag)
    
    
    app.use(store).use(router).mount('#app')
    
    


    工具里看是空 的

    控制台有个错误信息

    2021-05-31
    有用
    回复 3
    • iFangcy
      iFangcy
      2021-06-04
      你好,同样的报错,请问你解决了么?
      2021-06-04
      回复
    • 十二篇
      十二篇
      2021-07-28回复iFangcy
      解决了。
      2021-07-28
      回复
    • Hood
      Hood
      2021-09-03回复十二篇
      哈哈哈哈,太感谢了,我用的vue3.2.8版本
      2021-09-03
      回复
登录 后发表内容