目录

uniapp小程序实现分享,分享朋友圈功能

uniapp小程序实现分享,分享朋友圈功能

小程序实现分享分享朋友圈功能

小程序点击右上角三个点实现带参数分享,分享函数与onLoad,onShow同级
//分享时携带的参数在onload中获取
onLoad(options) {
	this.offActId = options.offActId
	console.log(this.offActId"offactId")
},
//分享
onShareAppMessage(res) {
	return {
		title: '一起来参加活动吧!',
		path: '/pages/otherPro/registration/registration?offActId='+this.detail.offActId
	}
},
//分享盆友圈
onShareTimeline(){
	return {
		title: '一起来参加活动吧!',
		path: '/pages/otherPro/registration/registration?offActId='+this.detail.offActId
	}
},

分享后,在onLoad函数中获取分享时传递的参数,

不带参数分享
//分享
onShareAppMessage(res) {
},
//分享盆友圈
onShareTimeline(res){
},

可以直接写上面的函数,分享出去会自己跳回分享的界面

分享效果图如下

https://i-blog.csdnimg.cn/blog_migrate/17361eb4d609bba25ef67be938a5e2cb.png