官方文档 https://developers.weixin.qq.com/miniprogram/dev/api/share.html
这里说由button发起的分享,onShareAppMessage里的options会返回target,但是实际测试却是,开发工具正常返回target,真机不返回target。
图一是开发工具的表现,图二是真机(华为荣耀8)的表现。
- 提供一个最简复现 Demo
<button size=“mini” type=“primary” open-type=“share”>分享button>
Page({
onShareAppMessage(options) {
if (options.from === ‘button’) {
wx.showModal({
content: JSON.stringify(options)
});
}
}
})
附上我的系统信息:
{
"screenWidth": 360,
"pixelRatio": 3,
"system": "Android 7.0",
"benchmarkLevel": 10,
"windowWidth": 360,
"brand": "honor",
"screenHeight": 598,
"version": "6.6.6",
"fontSizeSetting": 16,
"language": "en",
"windowHeight": 526,
"model": "FRD-AL00",
"platform": "android",
"SDKVersion": "2.0.0"
}