Super-scarlett

微信小程序--分享报错(thirdScriptError Cannot read property \'from\' of undefined;at pages/index/index page onShareAppMessage function TypeError: Cannot read property \'from\' of undefined)

分享功能:

 

onShareAppMessage: function (res) {
if (res.from === \'button\') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: \'首页\',
path: \'pages/index/index\',
imageUrl: "../../img/share.png"
}
}

 

今天在开发小程序分享功能时,报错如下。

thirdScriptError
Cannot read property \'from\' of undefined;at pages/index/index page onShareAppMessage function
TypeError: Cannot read property \'from\' of undefined

 

后来查看微信开发社区发现:

10月10日起新提交发布的版本,不再支持分享回调参数 success 、fail 、complete,即用户从小程序/小游戏中分享消息给好友时,开发者将无法获知用户是否分享完成,也无法在分享后立即获得分享成功后的回调参数shareTicket。该调整可以在基础库 2.3.0及以上版本体验。

 

由于不再支持分享回调参数,所以报错。报如下代码删除即可

if (res.from === \'button\') {
// 来自页面内转发按钮
console.log(res.target)
}

 

发表于 2018-09-27 11:19  苏小米  阅读(14595)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章:

  • 2021-07-24
  • 2021-11-30
  • 2021-08-17
  • 2021-04-10
  • 2021-11-02
  • 2021-10-30
  • 2022-01-21
  • 2021-12-22
猜你喜欢
  • 2021-09-21
  • 2021-12-09
  • 2021-12-24
  • 2021-09-17
  • 2021-04-02
  • 2022-01-06
  • 2021-08-12
相关资源
相似解决方案