微信小程序分享onShareAppMessage报错

问题

    微信小程序分享报错Cannot read property 'apply' of null;at pages/index/main page onShareAppMessage 

原因分析

    使用的是mpvue框架开发的微信小程序,在首页里面显示列表数据,

    首页显示列表信息,列表子组件显示内容。在显示页面点击子组件的分享报Cannot read property 'apply' of null;at pages/index/main page onShareAppMessage fun错误。

    分享按钮在子组件里, 报at page index错误 , index是item组件的父级,也就是说 onShareAppMessage() 分享函数,$\color{red}{不能在子组件去触发父级的分享}$

解决方案

    将onShareAppMessage 放在父级页面就可以了

你可能感兴趣的:(微信小程序分享onShareAppMessage报错)