收藏
回答

vue页面微信服务号订阅通知,在微信里没有弹出订阅通知消息?

我们想通过扫码进入网页,然后vue网页进行订阅公众号的通知。但是在页面上不弹出订阅通知的消息,config提示已经OK了,怎么回事?

代码如下

<template>
  <div class="wx-open-subscribe-container" style="position:absolute;width:100%;height:100%;top:0px;">
    <wx-open-subscribe :template="templateId" id="subscribe-btn"
                       style="position:absolute;width:100%;height:100%;left:0px;top:0px;overflow:hidden;"
                       @success="openSubscribeSuccess" @error="openSubscribeError">
      <script type="text/wxtag-template">
        <style>.btn {
          width: 100%;
          height: 500px;
        }</style>
        <div class="btn"></div>
      </script>
    </wx-open-subscribe>
  </div>
</template>
<script>
export default {
  props: {
    templateId: {
      type: String,
      default () {
        return ''
      }
    }
  },
  methods: {
    openSubscribeSuccess(e) {
      this.$emit('open-subscribe-success', e.detail)
    },
    openSubscribeError(e) {
      this.$emit('open-subscribe-error', e.detail)
    }
  }
}
</script>


<div class="" style="position:relative;">
  <el-button type="success" plain icon="el-icon-share" circle/>
  <open-subscribe
    template-id="9ScbTwgbZiW-FTOHd9Vt0sIScLG_T5OHsaXEdSy6dVc"
    @open-subscribe-success="openSubscribeSuccess"
    @open-subscribe-error="openSubscribeError"
  />
</div>

getJsSdkConfig () {
  let url = 'http://10.0.10.109:9567/sap/register/getWxConfigSubscribe?factory=' + this.formValidate.factroyId
  Axios.post(url).then(res => {
    this.appId = res.data.data.appId
    this.timestamp = res.data.data.timeStamp
    this.nonceStr = res.data.data.nonceStr
    this.signature = res.data.data.result
    // JS-SDK初始化
    wx.config({
      debug: true,
      appId: this.appId,
      timestamp: this.timestamp,
      nonceStr: this.nonceStr,
      signature: this.signature,
      jsApiList: [], // 必填,需要使用的JS接口列表
      openTagList: ['wx-open-subscribe']
    })
  })
},
openSubscribeSuccess (e) {
},
openSubscribeError (e) {
},
回答关注问题邀请回答
收藏

1 个回答

  • 郑海鳌
    郑海鳌
    发表于移动端
    2023-09-20
    气我他6
    2023-09-20
    有用
    回复
登录 后发表内容