uni-app小程序分享好友和朋友圈设置
onLoad(){
wx.showShareMenu({
withShareTicket:true,
//设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
menus:["shareAppMessage","shareTimeline"]
})
},
onShareAppMessage(res) {
if (res.from === 'button') {// 来自页面内分享按钮
console.log(res.target)
}
return {
title: 'title', //分享的名称
path: "/pages/index/index",
mpId:'wx525d71e6efc3fce0', //此处配置微信小程序的AppId
imageUrl:'../../static/share.jpg' //显示的图
}
},
//分享到朋友圈
onShareTimeline(res) {
return {
title: 'title',
type: 0,
summary: "",
}
},