页面button
<button open-type="share" >
xxx
</button>
js部分
onShareAppMessage(res) {
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '标题自拟',
path: '页面路径'
}
}
*onShareAppMessag和onload是同级的
onShareAppMessag的uniapp官方文档