微信小程序 “分享、转发”卡片被打开时获得相关信息

问题:
微信小程序 分享、转发完相应的卡片后,想要获得点击该卡片的相关信息。

解决方法
官方网站介绍
在这里插入图片描述

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){
    
    }
    }
  },
})

微信小程序 “转发”无法判断是否转发成功

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

网上查询,onShareAppMessage存在回调函数success,fail,complete,但经过测试,这三个函数并没有执行,时间:2019-06-25。(也可能是基础库的原因,我的基础库为2.4.3)。

猜你喜欢

转载自blog.csdn.net/shengmeshi/article/details/93618799
今日推荐