微信公众号禁用右上角分享

// 禁用分享(请求后台接口获取appid,签名,时间戳等数据)
    getJSSDK () {
      const that = this
      const url = api.getJSSDK
      const routerPath = window.location.href.split('#')[0]
      console.log(routerPath, 'routerPath')
      that.$POST(url, { url: routerPath }, res => {
        console.log(res, 'getJSSDK')
        if (res.errorCode === 0) {
          if (res.body) {
            window.wx.config({
              debug: false,
              appId: res.body.appId,
              timestamp: res.body.timestamp,
              nonceStr: res.body.nonceStr,
              signature: res.body.signature,
              jsApiList: ['hideMenuItems'],
              success: function (res) {
                alert('成功')
                console.log(res, '成功')
              },
              fail: function (res) {
                alert('失败失败')
                console.log(res, '失败')
              },
              complete: function (res) {
                alert('complete')
                console.log(res, '777777777777')
              }
            })
            window.wx.ready(function () {
              console.log('禁止分享')
              window.wx.hideMenuItems({ // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
                menuList: ['menuItem:share:appMessage', 'menuItem:share:timeline', 'menuItem:share:timeline', 'menuItem:share:qq', 'menuItem:favorite', 'menuItem:share:QZone', 'menuItem:openWithSafari', 'menuItem:copyUrl', 'menuItem:share:email']
              })
            })
          }
        }
      })
    },
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值