Relevant information is obtained when the WeChat Mini Program "Share, Forward" card is opened

Problem:
After sharing and forwarding the corresponding card in the WeChat applet, I want to get relevant information about clicking on the card.

Solution
Official website introduction
insert image description here

let testOptions;
Page({
    
    
	onLoad:function(options){
    
    
		//……其他逻辑
		wx.showShareMenu({
    
    
		  withShareTicket: true
		})
		testOptions = options;
		console.log('οnlοad==testOptions==',testOptions);
	},
	onShow: function (options) {
    
    
	    console.log('==οnshοw==testOptions==',testOptions);
	    //获取转发详细信息
	    wx.getShareInfo({
    
    
	      shareTicket: testOptions.ald_share_src,
	      success:function(res) {
    
    
	        console.log("wx.getShareInfo:::", res)
	      }
	    })
    },
  onShareAppMessage: function (res) {
    
    
    return {
    
    
      title: '标题',
      path: '/pages/index/index?a=123',
      imageUrl: '**.png',
      success: function (shareTickets) {
    
    },
      fail: function (res) {
    
    },
      complete:function(res){
    
    }
    }
  },
})

The WeChat applet “Forward” cannot determine whether the forwarding is successful

  onShareAppMessage: function (res) {
    
    
    return {
    
    
      title: '标题',
      path: '/pages/index/index?a=123',
      imageUrl: '**.png',
      success: function (shareTickets) {
    
    }, //该函数无用,没有执行
      fail: function (res) {
    
    }, //该函数无用,没有执行
      complete:function(res){
    
    } //该函数无用,没有执行
    }
  },

Online query, onShareAppMessage has callback functions success, fail, complete, but after testing, these three functions are not executed, time: 2019-06-25. (It may also be the reason for the base library, my base library is 2.4.3).

Guess you like

Origin blog.csdn.net/shengmeshi/article/details/93618799