文档:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html
//xxx.js
onShareAppMessage: function (res) {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: this.data.community,//标题
path: 'pages/index/index'//转发路径
//imageUrl: 有默认值,从顶部开始,高度为 80% 屏幕宽度的图像作为转发图片
}
},
//xx.js
onShareAppMessage: function (res) {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: wx.getStorageSync('userCommunity').community.community_name,
path: 'pages/proDetail/prodetail?pro=' + JSON.stringify(this.data.pro),//注意值是json字符串
//不然在( onLoad: function (options) { var proDetail = JSON.parse(options.pro);}) 会报(Unexpected token o in JSON at position 1)错误
imageUrl:this.data.pro.goods_pics[0].goods_pic
}
},