zoukankan      html  css  js  c++  java
  • 微信小程序--分享报错(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)
    }
  • 相关阅读:
    linux开启oracle服务
    一个tomcat多域名绑定多项目
    linux安装jdk1.7.0
    windows 查看端口进程和杀死进程
    windows2008 扩大远程连接数
    windows下用bak文件备份数据库
    linux常用命令
    mysql 开启远程连接访问
    windows 下tomcat安装
    IBM公司面试题
  • 原文地址:https://www.cnblogs.com/Super-scarlett/p/9712124.html
Copyright © 2011-2022 走看看