默认情况下分享是灰色的
只要重写onShareAppMessage方法就可以实现分享功能,分享有两种情况
一、一种是点击右上角三个点分享:判断res.from === 'menu'
onShareAppMessage (res) {
console.log(res);
if (res.from === 'menu') { // button:来自页面内分享按钮
return {
title: '标题',
path: '/pages/index/index',
imageUrl: '/static/register/img.jpg'
}
}
},
二、按钮分享:判断res.from === 'button',还需要在按钮上添加open-type="share"
<button type="default" open-type="share">分享</button>