收藏
回答

微信小程序按钮open-type=”share“无效?

微信小程序按钮open-type=”share“,在onShareAppMessage中能触发console.log 但无法发起分享

         

onShareAppMessage: function (res) {

  console.log(res);

  if( res.from == 'button' ){

    console.log(res);

    return {

      title: '快来注册成为会员,享受会员福利',

      desc: '快来注册成为会员,享受会员福利',

      path: '/pages/index/index?userid='+this.data.userdata.id // 路径,传递参数到指定页面。

    }

  }

  return {

    title: '快来注册成为会员,享受会员福利',

    desc: '快来注册成为会员,享受会员福利',

    path: '/pages/index/index?userid='+this.data.userdata.id // 路径,传递参数到指定页面。

  }


  }

微信开发工具版本:1.03.2006090

调试库:2.12.0


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

3 个回答

  • 剑尘
    剑尘
    2022-03-12

    我的也是 好难过


    2022-03-12
    有用
    回复
  • Mn
    Mn
    2020-08-11
      /**
       * 生命周期函数--监听页面加载
       */
      onLoad: function (options) {
        wx.showShareMenu({
          withShareTicket: true,
          menus: ['shareAppMessage'],
          success(res){
            console.log('分享渲染成功')
          },
          fail(e){
            console.error('分享渲染失败')
          },
        })
      },
    

    在onLoad加上wx.showShareMenu试试?

    2020-08-11
    有用
    回复 1
    • 阿清
      阿清
      2020-08-11
      没用 小程序自带的分享按钮可以
      2020-08-11
      1
      回复
  • .
    .
    2020-08-11

      onShareAppMessage: function (res) {

        let that = this;

        // 来自页面按钮的分享

        if (res.form == 'button'{

          console.log(res.target, res)

        }

        return {

          title: '',

          path: '/pages/index/index?scene=' + that.data.invite,

          imageUrl: '../../image/sharePng.png'

        }

      }


    2020-08-11
    有用
    回复 3
    • 阿清
      阿清
      2020-08-11
      试过了没用
      2020-08-11
      回复
    • 阿清
      阿清
      2020-08-11
      依然是触发了console.log 但分享窗口不出来 但小程序自带的分享按钮可以
      2020-08-11
      回复
    • .
      .
      2020-08-11回复阿清
      我的没问题啊。。。布吉岛了...
      2020-08-11
      回复
登录 后发表内容
问题标签