小程序组件内分享事件失效问题

解决办法:

onShareAppMessage是page的方法,Component里面是没有提供的,解决办法是在组件里写分享按钮,在原引用页面写分享事件方法
组件.wxml

<button  class="sharebutton"  open-type="share" bindtap="share"></button >


原引用页面.js

 onShareAppMessage: function (res) {
      return {
        title: '我们陪你一起到家!',
        path: "/pages/report-await/fouryearh5share,
        imageUrl: 'https://lbdj.oss-cn-beijing.aliyuncs.com/pc/img/activity/supplement/share.png',
         
      }
  }
原文地址:https://www.cnblogs.com/chenluqing/p/11284408.html