小程序 button分享自定义页面 open-type="sha

2020-07-07  本文已影响0人  ZOYA_MOLA

aaa.wxml

<button open-type="share">
    分享
  </button>

aaa.js

  // 用户点击按钮分享
  onShareAppMessage: function (res) {
      if (res.from === 'button') {
          // 来自页面内转发按钮
          console.log(res.target)
      }
      return {
          title: '自定义!',
          path: '/share/beInvolved/beInvolved',
          imageUrl: '../../img/share.png',
          success: function(res) {},
          fail: function() {}
      }
  },

踩坑纪实:
创建page的js底部自有onShareAppMessage事件
自定义的onShareAppMessage 被底部空白的 onShareAppMessage 干掉了

上一篇 下一篇

猜你喜欢

热点阅读