收藏
回答

open-type="share" onShareAppMessage不触发

框架类型 问题类型 API/组件名称 终端类型 操作系统 微信版本 基础库版本
小程序 Bug button 微信iOS客户端 6.7.0 2.2.1

button open-type="share" 不写onShareAppMessage 能分享   写了onShareAppMessage 不触发

<button open-type="share" class='fenxiang'></button>

//分享

onShareAppMessage: function (res) {

console.log('123');

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

console.log(res.target)

}

return {

title: '123123',

path: '/pages/list/play/play?id='+this.data.playid,

success: function (res) {

},

fail: function (res) {

}

}

},

// 生命周期函数--监听页面显示

onShow: function() {


},


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

2 个回答

  • 涤生
    涤生
    2023-01-13

    onShareAppMessage 要定义在页面级别的代码中,不放在组件级别的 onShareAppMessage。无法触发 onShareAppMessage 的话,你点右上角应该也是不能分享页面的

    2023-01-13
    有用
    回复
  • 是小白啊
    是小白啊
    2018-08-02

    你好,问题未复现。请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2018-08-02
    有用
    回复 1
    • Insane
      Insane
      2018-08-03

      已解决  在app.js

      pages里面写了  路劲自动生成的js等文件   js里面最后面写了个

      onShareAppMessage:function(){


      }

      覆盖了 我在前面写的

      onShareAppMessage




      2018-08-03
      回复
登录 后发表内容